LangChain with a custom base URL
Create ChatOpenAI with this base_url and your key, and LangChain runs Claude, GPT, Gemini and Grok models through your AIGROW key, in chains and agents alike.
Already have a code? Redeem it on API access, then create a key.
Python, with langchain-openai
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="claude-opus-5.5",
base_url="https://aigrow.gg/v1",
api_key="ag_your_key_here",
use_responses_api=False,
)
print(llm.invoke("Reply with the word ready").content)Swap ag_your_key_here for a key from API access.

What the film says
- Paying list price for Claude?
- Claude Opus 5.5, Claude Fable 5.2, GPT-6 Astra, Gemini 4 Argon and Grok 4.7, +4 more models
- $1.60 instead of $4.00. Per million input tokens on Claude Opus 5.5.
- 9 of 9 models on sale pass the check against the same model at its maker. The results and the script are public: aigrow.gg/ai-api/genuine-models
- API credit$100 of API credit for $25. Start today.
Where the setting lives
- Python, every model
pip install -U langchain-openai- Python, Claude on ChatAnthropic
pip install -U langchain-anthropic- JavaScript
npm install @langchain/openai @langchain/anthropic @langchain/core
Claude on ChatAnthropic
ChatAnthropic adds /v1/messages itself, so base_url is https://aigrow.gg with nothing after it. Set max_tokens to the length you want; for an id LangChain does not know, it falls back to a default of its own.
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(
model="claude-opus-5.5",
base_url="https://aigrow.gg",
api_key="ag_your_key_here",
max_tokens=1024,
)In JavaScript
The same two models in LangChain.js: configuration.baseURL on ChatOpenAI, anthropicApiUrl on ChatAnthropic.
import { ChatOpenAI } from '@langchain/openai';
import { ChatAnthropic } from '@langchain/anthropic';
const gpt = new ChatOpenAI({
model: 'gpt-6.1-sol',
apiKey: 'ag_your_key_here',
configuration: { baseURL: 'https://aigrow.gg/v1' },
});
const claude = new ChatAnthropic({
model: 'claude-opus-5.5',
apiKey: 'ag_your_key_here',
anthropicApiUrl: 'https://aigrow.gg',
});Or with environment variables
ChatOpenAI reads OPENAI_API_BASE, then OPENAI_BASE_URL. ChatAnthropic reads ANTHROPIC_API_URL, then ANTHROPIC_BASE_URL. A base_url in the code wins over all of them.
export OPENAI_API_BASE=https://aigrow.gg/v1
export OPENAI_API_KEY=ag_your_key_here
export ANTHROPIC_BASE_URL=https://aigrow.gg
export ANTHROPIC_API_KEY=ag_your_key_hereWhich model to use
Put the id in exactly as it is written here.
- Claude Opus 5.5
claude-opus-5.5 - The default in every block on this page and a good main model for agent work. Context: 1,000,000 tokens.
- Grok 4.7
grok-4.7 - For a Grok model. It costs less than Opus per token sent and per token received. Context: 500,000 tokens.
- GPT-6.1 Sol
gpt-6.1-sol - For a GPT model. It costs less than Opus per token sent and per token received. Context: 1,050,000 tokens.
- Claude Fable 5.2
claude-fable-5.2 - Costs more per token than Opus. Compare the two on the coding leaderboard before you switch. Context: 1,000,000 tokens.
The price list has every id and its credit rate, Claude API pricing has the list prices, and the coding leaderboard compares the models on coding prompts.
Check that it works
First the key on its own, then LangChain with it.
The key
Ask for the model list. It needs a valid key and costs nothing.
curl https://aigrow.gg/v1/models -H "Authorization: Bearer ag_your_key_here"{
"object": "list",
"data": [
{ "id": "claude-opus-5.5", "object": "model", ... },
{ "id": "claude-fable-5.2", "object": "model", ... },
{ "id": "claude-fable-5.1", "object": "model", ... },
{ "id": "gpt-6.2-astra", "object": "model", ... },
{ "id": "gpt-6-astra", "object": "model", ... },
{ "id": "claude-sonnet-5.5", "object": "model", ... },
{ "id": "claude-haiku-5.5", "object": "model", ... },
{ "id": "gpt-6.2-sol", "object": "model", ... },
{ "id": "gpt-6.1-sol", "object": "model", ... },
{ "id": "gpt-6.1-terra", "object": "model", ... },
{ "id": "gpt-6-luna", "object": "model", ... },
{ "id": "grok-4.7", "object": "model", ... },
{ "id": "gemini-4-argon", "object": "model", ... },
{ "id": "qwen3.8-max", "object": "model", ... },
{ "id": "kimi-k3.1-pro", "object": "model", ... },
{ "id": "gemini-4-hydrogen", "object": "model", ... },
{ "id": "gemini-4-neon", "object": "model", ... },
{ "id": "gemini-3.8-flash", "object": "model", ... },
...
],
"has_more": false
}LangChain
Save the block as check.py, put your key in and run it.
python check.pyreadyWhen it fails
The LangChain errors first, then the answers the endpoint gives any tool.
- 400 once tools or reasoning are added
- ChatOpenAI moved the call to the Responses API, which it does on its own for built-in tools, reasoning settings and some GPT models. use_responses_api=False, as in the block, keeps every call on chat completions.
- 404 on ChatAnthropic
- base_url ends in /v1. ChatAnthropic adds /v1/messages itself, so it is https://aigrow.gg.
- The key is sent to OpenAI or Anthropic
- The base URL did not reach the model. Pass base_url to ChatOpenAI or ChatAnthropic directly; it wins over every environment variable.
- My tool says 401 or authentication error
- The key is missing or mistyped. Copy it again from API access on the dashboard, and make sure it is sent as the key, not as a model name. A revoked key fails the same way: create a new one and swap it in.
- I get 402 or a message about credit
- Your balance is empty. Open API access on the dashboard, redeem a code or buy another pack, and the next request goes through. Nothing else needs to change.
- It says 404 or Unknown model
- The model has to be one the endpoint serves, for example claude-opus-5.5. The provider’s own spellings work too (claude-opus-5-5, anthropic/claude-opus-5.5), but a dated id or any model outside the catalogue is rejected before the request is forwarded, and nothing is billed. Request GET /v1/models with your key for the live list, or read the ids on the price list.
- Requests are rejected with 429
- The endpoint asked you to slow down. Each 429 carries a retry-after header, and the OpenAI and Anthropic SDKs wait that long and retry on their own. In a loop of your own, wait the seconds it names or send fewer requests at once. A refused request is not billed.
- The model is unavailable right now
- A 404 that says the model is not available right now means that model is briefly unavailable. Your key and balance are fine. Retry in a moment or send the request to another model.
- I get a 503
- A temporary error, and it is never charged to your balance. Retry the request; if it keeps failing, reach us through the store and we will look into it. When the error says the answer took too long to complete, the whole answer ran past the time limit: for long answers, send the request with "stream": true. On Claude in the Anthropic format, an answer still unfinished 240 seconds after the request ends with this error.
What does not work through AIGROW
OpenAI built-in tools such as web search, file search and code interpreter, which ChatOpenAI sends to the Responses API. Tools you bind with bind_tools run in your own code and work.
Live web search inside the model. On /v1/chat/completions and /v1/messages, a web search tool sent with a request is answered from what the model already knows, with no live results, and /v1/responses refuses it. A tool that fetches pages on your own machine still works.
Any endpoint past /v1/messages, /v1/chat/completions, /v1/responses, /v1/images, /v1/videos and /v1/models: embeddings, audio and token counting answer 404. The Responses API at /v1/responses serves the GPT models only, without hosted tools or stored conversations.
Images: /v1/images/generations and /v1/images/edits take gpt-image-2.6-flare only, one image per request, at 1024x1024, 1024x1536, 1536x1024 or auto, and answer with base64 in b64_json. response_format, n above 1, another size, streaming, or any field beyond model, prompt, n, size, quality, background, output_format, output_compression, moderation and user (and input_fidelity on an edit) answers 400. A client’s own image feature is untested here.
Router fields such as models, route, provider and plugins. They are dropped, so a request always goes to the one model it names.
What a month of LangChain costs
LangChain is billed per token at the credit rates in the price list. An agent sends the whole conversation again with each step, so a long task costs more than its last message suggests; the activity log on API access shows what each request cost.
Cap what LangChain can spend
Questions about LangChain and a custom API
- How do I set base_url in LangChain ChatOpenAI?
- Pass base_url="https://aigrow.gg/v1" and api_key with your key when you create ChatOpenAI. openai_api_base is another name for the same setting, and OPENAI_API_BASE or OPENAI_BASE_URL in the environment work too.
- How do I set a base URL for ChatAnthropic?
- Pass base_url="https://aigrow.gg" in Python, or anthropicApiUrl in JavaScript. Leave /v1 off, because the client adds /v1/messages itself. ANTHROPIC_BASE_URL in the environment works too.
- Why set use_responses_api=False?
- ChatOpenAI switches to the Responses API on its own for built-in tools, reasoning settings and some GPT models. The endpoint serves that API for GPT models only and without built-in tools, so False keeps every call on chat completions, which runs every model.
- Can ChatOpenAI run Claude models?
- Yes. The endpoint serves Claude models on the OpenAI protocol too, so model="claude-opus-5.5" works in ChatOpenAI with the same base_url. ChatAnthropic is the way to send them on the Anthropic protocol.
- Can I limit what LangChain spends?
- Yes. Give LangChain its own key on API access and set a monthly cap on it. Once the key has spent its cap in a calendar month (UTC), its requests get a 402 error until the 1st of the next month, and your other keys keep working.
Sources: LangChain ChatOpenAI · LangChain ChatAnthropic reference · LangChain ChatOpenAI for JavaScript. Read 21 October 2026.
Set up another tool
- Vercel AI SDKAnthropic and OpenAI protocols
The OpenAI Compatible provider for every model, or the Anthropic provider for Claude.
- OpenAI Agents SDKOpenAI protocol
Your own AsyncOpenAI client, switched to chat completions, with tracing off.
- LlamaIndexOpenAI protocol
OpenAILike from llama-index-llms-openai-like with is_chat_model=True.
- CrewAIAnthropic and OpenAI protocols
LLM(custom_openai=True, base_url=...) for every model, or native anthropic/.
- AutoGen (AG2)OpenAI protocol
LLMConfig with api_type "openai" and base_url in ag2[openai].
- Pydantic AIAnthropic and OpenAI protocols
OpenAIChatModel with OpenAICompatibleProvider, or AnthropicProvider with AsyncAnthropic.
- DSPyOpenAI protocol
dspy.LM("openai/<model>", api_base=..., api_key=...) with dspy.configure.
- MastraAnthropic and OpenAI protocols
A model config object with id, url and apiKey on Mastra’s Agent.
- HaystackOpenAI protocol
OpenAIChatGenerator with api_base_url and Secret.from_env_var.
- Semantic KernelOpenAI protocol
AddOpenAIChatCompletion with endpoint: new Uri(...) and SKEXP0010 in .NET.
- LiteLLMOpenAI protocol
model="openai/<id>" with api_base and api_key in the Python SDK or Proxy config.yaml.
- smolagentsOpenAI protocol
OpenAIModel(model_id, api_base, api_key) for CodeAgent and ToolCallingAgent.
- AgnoAnthropic and OpenAI protocols
OpenAILike(id, base_url, api_key) for every model, or Claude with client_params.
- Google ADKAnthropic and OpenAI protocols
LiteLlm(model="openai/<id>", api_base=...) or AnthropicLlm in Python, openaimodel in Go.
- Claude Agent SDKAnthropic protocol
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in ClaudeAgentOptions.env (Python & TS).
- Anthropic SDKAnthropic protocol
base_url in Python (anthropic) and baseURL in TypeScript (@anthropic-ai/sdk).
- OpenAI SDKOpenAI protocol
Chat Completions in the official Python, Node, Go, Java and .NET OpenAI SDKs.
- Spring AIAnthropic and OpenAI protocols
spring.ai.openai.base-url (with /v1 in 2.x, without /v1 in 1.x) or spring.ai.anthropic.base-url.
- GenkitOpenAI protocol
openAICompatible with name, baseURL and apiKey from @genkit-ai/compat-oai.
- Strands AgentsAnthropic and OpenAI protocols
OpenAIModel or AnthropicModel with base_url and api_key in client_args.
- MirascopeAnthropic and OpenAI protocols
llm.register_provider("openai:completions", base_url=...) or "anthropic" in Python.
- TanStack AIOpenAI protocol
openaiCompatible with baseURL, apiKey and models from @tanstack/ai-openai/compatible.
- RubyLLMAnthropic and OpenAI protocols
config.openai_api_base with protocol: :chat_completions, or config.anthropic_api_base.
- ruby-openaiOpenAI protocol
OpenAI::Client.new(access_token: ..., uri_base: ...) with client.chat.
- openai-php/clientOpenAI protocol
OpenAI::factory()->withApiKey(...)->withBaseUri(...)->make() in PHP.
- ReqLLMAnthropic and OpenAI protocols
ReqLLM.model! with provider, id and base_url in Elixir.
- MacPaw OpenAIOpenAI protocol
OpenAI.Configuration(token: ..., host: ..., basePath: "/v1", parsingOptions: .relaxed) in Swift.
- dart_openaiOpenAI protocol
OpenAIClient(apiKey: ..., baseUrl: ...) with client.chat.create in Dart or Flutter.
- InstructorAnthropic and OpenAI protocols
instructor.from_provider("openai/...", base_url=...) or instructor.from_anthropic(Anthropic(...)).
- LangChain4jAnthropic and OpenAI protocols
OpenAiChatModel.builder().baseUrl(...) or AnthropicChatModel.builder().baseUrl(...).
- LlamaIndex.TSAnthropic and OpenAI protocols
new OpenAI with baseURL, apiKey and model from @llamaindex/openai, or AnthropicSession.
- Microsoft Agent FrameworkOpenAI protocol
OpenAIChatCompletionClient(base_url=..., api_key=..., model=...) in Python.
- Atomic AgentsAnthropic and OpenAI protocols
instructor.from_openai(OpenAI(base_url=...)) or from_anthropic passed to AgentConfig.
- BAMLAnthropic and OpenAI protocols
provider "openai-generic" with base_url, or provider anthropic in clients.baml.
- OutlinesAnthropic and OpenAI protocols
outlines.from_openai(openai.OpenAI(base_url=...)) or outlines.from_anthropic.
- RigAnthropic and OpenAI protocols
OpenAIConfig::new(key).with_base_url(...).client().chat(id) or AnthropicConfig in Rust.
- async-openaiOpenAI protocol
OpenAIConfig::new().with_api_base(...).with_api_key(...) with Client::with_config in Rust.
- go-openaiOpenAI protocol
openai.DefaultConfig(key) with config.BaseURL and openai.NewClientWithConfig in Go.
- Laravel PrismAnthropic and OpenAI protocols
Provider::Anthropic with ANTHROPIC_URL or Provider::OpenRouter with OPENROUTER_URL.
- Symfony AIOpenAI protocol
Symfony\AI\Platform\Bridge\Generic\Factory::createPlatform(baseUrl, apiKey).
- openai-kotlinOpenAI protocol
OpenAIConfig(token = ..., host = OpenAIHost(baseUrl = ".../v1/")) with trailing slash.
- KoogAnthropic and OpenAI protocols
OpenAILLMClient with OpenAIClientSettings(baseUrl) or AnthropicLLMClient in Kotlin.
- ellmerAnthropic and OpenAI protocols
chat_openai_compatible(base_url = ..., model = ...) or chat_anthropic in R.
- Semantic Kernel for PythonAnthropic and OpenAI protocols
OpenAIChatCompletion(ai_model_id=..., async_client=AsyncOpenAI(base_url=...)) or AnthropicChatCompletion.
- Anthropic Go SDKAnthropic protocol
option.WithBaseURL and option.WithAPIKey on anthropic.NewClient, or ANTHROPIC_BASE_URL, in Go.
- EinoOpenAI protocol
BaseURL, APIKey and Model in openai.ChatModelConfig for Eino's OpenAI chat model in Go.
- Instructor for ElixirOpenAI protocol
openai api_url and api_key in the instructor config, with mode :json, for Elixir structured output.
- LangChain for ElixirOpenAI protocol
ChatOpenAICompatible endpoint, api_key and model in an Elixir LLMChain.
- LangChainGoOpenAI protocol
openai.WithBaseURL, openai.WithToken and openai.WithModel on openai.New in Go.
- Langchain.rbOpenAI protocol
llm_options uri_base and default_options chat_model on Langchain::LLM::OpenAI.new in Ruby.
- LLPhantOpenAI protocol
OpenAIConfig url, apiKey and model passed to new OpenAIChat in PHP.
- Microsoft.Extensions.AIOpenAI protocol
IChatClient from an OpenAI ChatClient with OpenAIClientOptions Endpoint and AsIChatClient in .NET.
- Neuron AIOpenAI protocol
OpenAILike provider with baseUri, key and model in a Neuron AI agent for PHP.
- OpenAI .NET libraryOpenAI protocol
OpenAIClientOptions Endpoint and ApiKeyCredential on a ChatClient in C#.
- genai (Rust)OpenAI protocol
GENAI_1_ENDPOINT and GENAI_1_API_KEY with the genai_1:: model namespace in the Rust genai crate.
- SwiftAnthropicAnthropic protocol
basePath, apiKey and betaHeaders on AnthropicServiceFactory.service in Swift.
- VoltAgentOpenAI protocol
createOpenAICompatible with baseURL and apiKey as the model of a VoltAgent Agent in TypeScript.
The API guide has the SDKs, curl, the endpoints and the error codes.
Paste the block and LangChain runs on your credit.
Buy a credit pack, redeem the code from your email on API access, create a key and put it in place of ag_your_key_here.