How to Configure Base URL in Codex, Claude Code, Cursor, and Cline
Base URL and API key setup for Codex, Claude Code, Cursor, Cline, and LangChain, with troubleshooting steps for common configuration errors.
Developer tools expose different settings, but most integration issues come from four places: where the key is stored, whether the Base URL is correct, whether the model ID is available, and whether the tool uses an OpenAI compatible or Anthropic compatible protocol.
Common setup table
- OpenAI compatible Base URL: https://bigmodel.io/v1.
- API key: use the sk- key created in the BigModel.io console.
- Model ID: use the model catalog or pricing page as the source of truth.
- Validation: start with a minimal request before enabling streaming, tools, or long context.
Codex config.toml example
Merge this into ~/.codex/config.toml and set BIGMODEL_API_KEY in the environment that launches Codex. Use a model verified for the Responses API; Chat Completions support alone does not establish Responses support.
model_provider = "bigmodel"
model = "YOUR_VERIFIED_MODEL_ID"
[model_providers.bigmodel]
name = "BigModel.io"
base_url = "https://bigmodel.io/v1"
wire_api = "responses"
env_key = "BIGMODEL_API_KEY"Claude Code environment variables
This example requires a verified Anthropic Messages gateway and Claude model. Set BIGMODEL_API_KEY and BIGMODEL_MODEL_ID first. Use https://bigmodel.io as the gateway root: the client appends /v1/messages. Verify the selected model and tool capabilities end to end.
export ANTHROPIC_AUTH_TOKEN="${BIGMODEL_API_KEY:?Set BIGMODEL_API_KEY first}"
export ANTHROPIC_BASE_URL="https://bigmodel.io"
claude --model "${BIGMODEL_MODEL_ID:?Set a verified Claude model ID}"Run /status in Claude Code to inspect the endpoint and credential source, then check actual requests and console usage. A model response cannot confirm its own configuration.
Cursor and Cline setup notes
- Find the OpenAI Compatible, Custom Endpoint, or API Provider setting.
- Set Base URL to https://bigmodel.io/v1, not /v1/chat/completions.
- Use a real key from the console, not an example key from documentation.
- Manually enter a model ID that is available on the pricing or model catalog page.
Minimal LangChain example
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
model: process.env.BIGMODEL_MODEL_ID,
apiKey: process.env.BIGMODEL_API_KEY,
configuration: {
baseURL: "https://bigmodel.io/v1",
},
});
const result = await model.invoke("List five things to verify before launch.");
console.log(result.content);Troubleshooting order
- Print the Base URL the tool actually reads and check for duplicate /v1.
- Switch to a minimal request to remove prompt, tool-call, and long-context variables.
- Try a known available model ID to rule out model-name issues.
- Restart the tool or clear local cache because many IDEs cache provider settings.
- Contact the Support & feedback page in the console with error code, time, model ID, and tool name.
FAQ
- Should Base URL include /chat/completions? No. The SDK or tool appends request paths.
- Why does one tool work while another fails with the same key? Protocol type, model ID, or cached settings often differ.
- Can one key be used by multiple tools? Yes, but production tools should have separate keys.