CrossModel

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

CapabilitySupport
OpenAI Chat CompletionsSupported — multi-turn messages, streaming, image input, function tools, common sampling parameters.
OpenAI ResponsesCore input/output, streaming events, and function tools supported. Some advanced state-management fields aren't guaranteed across models.
Anthropic MessagesCore Messages protocol, streaming events, image input, and tool calling supported.
/v1/modelsList models and look up a single model.

Differences to watch for

  • CrossModel model IDs use the vendor/model format.
  • The Anthropic Messages endpoint prefers x-api-key; OpenAI-compatible endpoints use Authorization: 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

  1. Swap the base URL.
  2. Swap the API key.
  3. Swap the model ID.
  4. Confirm the header format matches your chosen protocol.
  5. Confirm your streaming reader handles that protocol's events.
  6. Confirm error handling covers 401, 402, 429, 502, and 503.
  7. Validate advanced features — tool calls, multimodal, JSON output — with a small amount of traffic first.