---
title: Compatibility & migration
description: What to change and watch for when moving to CrossModel from OpenAI or Anthropic.
---

# 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:

```python
from openai import OpenAI

client = OpenAI(api_key="sk-...")
```

Switch to CrossModel:

```python
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:

```python
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:

```bash
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` | OpenAI- and Anthropic-compatible authentication and union response fields for listing or retrieving models. |

## Differences to watch for

- CrossModel model IDs use the `vendor/model` format.
- Anthropic Messages prefers `x-api-key`; OpenAI-compatible inference endpoints use `Authorization: Bearer`. `/v1/models` accepts either header.
- 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](/docs/api-reference/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.
