Move from the OpenAI or Anthropic API without a rewrite
Keep your SDK, messages and tools. Change the base URL, key and model id, test one request, then move your traffic.
Get API key Read the quickstart
The whole change, before and after.
Swap minus lines for plus lines; nothing else changes.
app.pyOpenAI · PythonOpenAI Python SDK
Pass the Modellane base URL and key when you create the client; the Node SDK takes the same three lines.
client = OpenAI( - api_key=os.environ["OPENAI_API_KEY"], + api_key=os.environ["MODELLANE_API_KEY"], + base_url="https://usemodellane.com/v1", ) response = client.chat.completions.create( - model="your-current-model", + model="deepseek-v4.1-flash", messages=messages, )app.pyAnthropic · PythonAnthropic SDK
The base URL has no /v1: the SDK adds /v1/messages itself. The key still goes in x-api-key.
client = anthropic.Anthropic( - api_key=os.environ["ANTHROPIC_API_KEY"], + api_key=os.environ["MODELLANE_API_KEY"], + base_url="https://usemodellane.com", ) message = client.messages.create( - model="your-current-model", + model="deepseek-v4.1-flash", max_tokens=1024, messages=messages, ).envenvironmentEnv variables
Both SDKs read the base URL and key from the environment, so only the model id changes in code.
# OpenAI SDKs -OPENAI_API_KEY=<your current key> +OPENAI_API_KEY=<your Modellane key> +OPENAI_BASE_URL=https://usemodellane.com/v1 # Anthropic SDKs -ANTHROPIC_API_KEY=<your current key> +ANTHROPIC_API_KEY=<your Modellane key> +ANTHROPIC_BASE_URL=https://usemodellane.com/v1/chat/completionscurlTest request
Send one request before you touch your app; a reply means the key, address and model id are right.
curl https://usemodellane.com/v1/chat/completions \ -H "Authorization: Bearer $MODELLANE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Hello"}] }'
Five steps from first key to full traffic.
Most apps are done after step three.
Create a key
Create one in the dashboard and store it as MODELLANE_API_KEY; it is shown once.
Change the base URL
OpenAI clients use https://usemodellane.com/v1; Anthropic clients use https://usemodellane.com, without /v1.
Pick a model
Copy an id from the model catalog; model names from other APIs are not mapped.
Test one request
Send one request: invalid_api_key points at the key, model_not_found at the model id.
Roll out
Switch the environment variables after checking your project's rate limits.
What carries over, and what is different.
A few features are not offered, mostly because nothing is stored.
What carries over
- Chat Completions messages, streaming, tools, tool_choice, JSON mode, stop, temperature, top_p and max_tokens
- Messages with tool_use and tool_result blocks, streaming and token counting
- Responses with function tools, streaming and text.format
- Base64 images, on models with Vision
- Listing models through the SDK
What is different
- Responses is stateless: previous_response_id and conversation are rejected
- Image links are rejected; send base64 data
- Chat Completions fields outside the reference are ignored
- Anthropic server tools (web search, code execution) are ignored
- No Assistants, embeddings, audio, Files API or Message Batches
Bring your tools along.
Editors and agents that take a custom API base URL.
Codex
A config.toml entry for the Responses API.
Claude Code
Environment variables for the Messages API.
Cline
An OpenAI-compatible endpoint in VS Code.
Roo Code
OpenAI Compatible, with a tool-call model.
Aider
OpenAI settings and the openai/ prefix.
OpenCode
A custom OpenAI-compatible endpoint.
FAQ
Migration questions
- Do I have to change SDKs?
- No. The OpenAI and Anthropic SDKs work as they are. Set the base URL and your Modellane key, then use a Modellane model id.
- Will my current model names work?
- No. Model names from other APIs are not mapped. Pick an id from the model catalog and put it in the model field.
- Can I move part of my traffic first?
- Yes. Create a second client with the Modellane base URL and key, and send only some requests through it until you are ready to switch.
- Do Responses conversations carry over?
- Nothing is stored, so there is no earlier response to continue from. Keep the history in your app and send it in input with each request.
- Is there a field-by-field list of what is supported?
- Yes. The Chat Completions, Messages and Responses references list every field, and the Messages and Responses guides cover each mapping and limit.
- How is usage billed after I switch?
- From a prepaid balance. Every request is charged at the model's per-token rate when it finishes.
Change three lines and send your first request.
Create a key, add balance and keep the code you already have.