# Migrate from another gateway (/en/docs/cookbook/migration/from-other-gateways)



Migrate one request first: change the API base URL, the Key, and the model ID. The example below targets an OpenAI Chat Completions-compatible client. It does not translate a different request protocol automatically.

## 1. Prepare your terminal [#1-prepare-your-terminal]

Use Python 3.10+ and [uv](https://docs.astral.sh/uv/getting-started/installation/). Put your [Praxis cloud API Key](/en/docs/developers/account/api-keys) in `PRAXIS_API_KEY`; do not put it in source code or logs.

```bash
test -n "$PRAXIS_API_KEY"
```

Expected: exit code 0. Exit code 1 means the variable is missing. Examples default to `https://api.deepraxis.com`. To switch environments, set `PRAXIS_API_BASE` to the API origin without a trailing slash or API path.

## 2. Change three settings [#2-change-three-settings]

1. Set `base_url` to `https://api.deepraxis.com/openai/v1`. Expected: the URL contains `/openai/v1` exactly once; it is not a Console URL or the full `/chat/completions` endpoint.
2. Use `PRAXIS_API_KEY` for the client Key. Expected: the old gateway's Key is no longer sent to Praxis. Keep the old configuration separately for rollback.
3. Use `deepseek-flash` as the model ID for this smoke test. Expected: it appears in `GET /openai/v1/models?api=chat`. A vendor prefix or alias from the previous gateway is not automatically valid here.

Choose the detailed migration guide matching your current API:

| Current API or gateway               | Guide                                                          |
| ------------------------------------ | -------------------------------------------------------------- |
| OpenAI Chat Completions or Responses | [From OpenAI](/en/docs/cookbook/migration/from-openai)         |
| OpenRouter                           | [From OpenRouter](/en/docs/cookbook/migration/from-openrouter) |
| Anthropic Messages                   | [From Anthropic](/en/docs/cookbook/migration/from-anthropic)   |

## 3. Verify the new configuration [#3-verify-the-new-configuration]

Save as `gateway-migration.py` and run `uv run -q --no-project --with openai --with anthropic --with google-genai python gateway-migration.py`.

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ['PRAXIS_API_KEY'],
    base_url=os.environ.get('PRAXIS_API_BASE', 'https://api.deepraxis.com') + '/openai/v1')
models = client.models.list(extra_query={'api': 'chat'})
print('catalog X-Request-Id:', models._request_id)
assert 'deepseek-flash' in [model.id for model in models]
response = client.chat.completions.create(model='deepseek-flash',
    messages=[{'role': 'user', 'content': 'Reply with exactly: MIGRATION_OK'}],
    reasoning_effort='none', max_tokens=256)
print('X-Request-Id:', response._request_id)
assert response.choices[0].finish_reason == 'stop'
assert response.choices[0].message.content.strip() == 'MIGRATION_OK'
assert response.usage is not None and response.usage.total_tokens > 0
print(response.choices[0].message.content)
print('usage:', response.usage.model_dump())
```

Expected: `MIGRATION_OK`, positive token usage, a catalog request ID, and an inference request ID. Exit code 0. Keep request IDs for troubleshooting, not the Key.

## 4. Check before switching traffic [#4-check-before-switching-traffic]

Run your own prompts and check streaming, tools, structured output, and [reasoning settings](/en/docs/developers/model/guides/reasoning). A successful smoke test does not establish identical model behavior. Recreate any needed file or response resources: IDs from the old gateway do not migrate with configuration. If verification fails, restore the saved base URL, Key, and model together.

An observed request for `gpt-5.6-sol` on Responses returned `model_protocol_not_offered` (HTTP 404). Chat support does not imply Responses support; use the Responses-filtered catalog described in the [Responses guide](/en/docs/developers/model/guides/responses-api). A failed model assertion means the selected ID is absent from that protocol's catalog; recheck it before sending traffic.

[API reference →](/en/docs/api/compatible/openai) · [Model guides →](/en/docs/developers/model/guides/openai-compatible)
