Compatibility & migration
CrossModel is designed so that existing OpenAI or Anthropic projects can reach multi-model capabilities with minimal code changes. In most cases you only change the base URL, the API key, and the model ID.
Migrating from OpenAI
Original OpenAI SDK:
from openai import OpenAI
client = OpenAI(api_key="sk-...")Switch to CrossModel:
from openai import OpenAI
client = OpenAI(
api_key="cm-YOUR_KEY",
base_url="https://api.crossmodel.ai/v1",
)Use a CrossModel model ID in your requests:
completion = client.chat.completions.create(
model="deepseek/deepseek-v4-pro",
messages=[{"role": "user", "content": "Hello"}],
)Migrating from Anthropic
Point the SDK's base URL at CrossModel and use a cm- API key. With a direct HTTP call:
curl https://api.crossmodel.ai/v1/messages \
-H "x-api-key: $CROSSMODEL_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello" }]
}'What's compatible
| Capability | Support |
|---|---|
| OpenAI Chat Completions | Supported — multi-turn messages, streaming, image input, function tools, common sampling parameters. |
| OpenAI Responses | Core input/output, streaming events, and function tools supported. Some advanced state-management fields aren't guaranteed across models. |
| Anthropic Messages | Core Messages protocol, streaming events, image input, and tool calling supported. |
/v1/models | List models and look up a single model. |
Differences to watch for
- CrossModel model IDs use the
vendor/modelformat. - The Anthropic Messages endpoint prefers
x-api-key; OpenAI-compatible endpoints useAuthorization: Bearer. - Some advanced parameters are forwarded to the underlying model, but whether they take effect depends on the provider and the model's capabilities.
- Some advanced Responses fields aren't part of the stable support surface yet — e.g. multi-turn state, background tasks, prompt management. See the /v1/responses reference for specifics.
- Error messages and advanced-parameter support vary across providers; branch on the HTTP status code and the documented error types.
Migration checklist
- Swap the base URL.
- Swap the API key.
- Swap the model ID.
- Confirm the header format matches your chosen protocol.
- Confirm your streaming reader handles that protocol's events.
- Confirm error handling covers
401,402,429,502, and503. - Validate advanced features — tool calls, multimodal, JSON output — with a small amount of traffic first.