OpenAI compatibility
Routic's API is fully compatible with OpenAI's request and response format. If you're already using the OpenAI SDK or any OpenAI-format tool, just change base_url and api_key to switch to Routic.
Quick switch
from openai import OpenAI
# Before
client = OpenAI(
api_key="sk-openai-xxx",
)
# Switch to Routic — only two lines change
client = OpenAI(
base_url="https://api.routic.ai/v1",
api_key="sk-xxxxxxxx",
)
All subsequent code (client.chat.completions.create, client.models.list, etc.) stays the same.
Compatible endpoints
| Endpoint | Path | Compatibility |
|---|---|---|
| Chat completions | POST /v1/chat/completions | ✅ Fully compatible |
| Models | GET /v1/models | ✅ Fully compatible |
| Streaming | POST /v1/chat/completions + stream: true | ✅ Fully compatible |
| Function calling | tools / tool_choice params | ✅ Fully compatible |
| JSON mode | response_format: { type: "json_object" } | ✅ Fully compatible |
| Thinking mode | thinking param (extension) | 🔶 Routic extension, not in OpenAI |
| Smart routing | model: "auto/*" format (extension) | 🔶 Routic extension, not in OpenAI |
Compatible parameters
Chat completions parameters
| Parameter | OpenAI | Routic | Notes |
|---|---|---|---|
model | ✅ | ✅ | Routic also supports auto/* smart routing names |
messages | ✅ | ✅ | Identical format |
temperature | ✅ | ✅ | Range 0–2 |
top_p | ✅ | ✅ | |
max_tokens | ✅ | ✅ | |
stream | ✅ | ✅ | |
stop | ✅ | ✅ | Up to 4 stop sequences |
frequency_penalty | ✅ | ✅ | Range -2–2 |
presence_penalty | ✅ | ✅ | Range -2–2 |
tools | ✅ | ✅ | |
tool_choice | ✅ | ✅ | |
response_format | ✅ | ✅ | |
logprobs | ✅ | ✅ | |
top_logprobs | ✅ | ✅ | |
thinking | ❌ | ✅ | Routic extension: enables thinking mode |
n | ✅ | ❌ | Not supported — always returns 1 choice |
seed | ✅ | ❌ | Not supported yet |
logit_bias | ✅ | ❌ | Not supported yet |
Response fields
| Field | OpenAI | Routic | Notes |
|---|---|---|---|
id | ✅ | ✅ | |
object | ✅ | ✅ | "chat.completion" |
choices | ✅ | ✅ | |
usage.prompt_tokens | ✅ | ✅ | |
usage.completion_tokens | ✅ | ✅ | |
usage.total_tokens | ✅ | ✅ | |
usage.prompt_cache_hit_tokens | ❌ | ✅ | Cached tokens billed at a lower rate |
usage.prompt_cache_miss_tokens | ❌ | ✅ | Non-cached tokens |
choices[].message.reasoning_content | ❌ | ✅ | Thinking chain content (when thinking mode is enabled) |
Incompatibilities
Different model names
OpenAI model names (gpt-4o, gpt-4o-mini) are not available on Routic. Use Routic's model names instead:
| Use case | OpenAI model | Routic alternative |
|---|---|---|
| General chat | gpt-4o-mini | deepseek-v3 or auto/chat |
| Complex reasoning | o1 / o3-mini | deepseek-r1 or auto/reasoning |
| Code generation | gpt-4o | deepseek-v3 or deepseek-r1 |
See the Model catalog for the full list.
Embeddings and Images not available
Routic currently supports text generation only (Chat Completions). The following OpenAI endpoints are not supported:
POST /v1/embeddingsPOST /v1/images/generationsPOST /v1/audio/*
Authentication
OpenAI uses Authorization: Bearer sk-xxx — same as Routic. The only difference is the key prefix:
- OpenAI:
sk-proj-... - Routic:
sk-...
Compatible tools and frameworks
Because Routic is fully OpenAI-compatible, these tools work out of the box:
| Tool | How to connect |
|---|---|
| Cursor | Change OpenAI Base URL → see guide |
| Claude Code | Change Anthropic Base URL → see guide |
| Aider | Change --openai-api-base → see guide |
| LangChain | ChatOpenAI(base_url=..., api_key=...) |
| LlamaIndex | Same config as LangChain |
| Continue.dev | Change API Base URL in settings |
| Cline / Roo Code | Change API Base URL in settings |
Any tool that supports a custom OpenAI Base URL works with Routic.