Route Mapping
Quick Migration Recipes
OpenAI to AI Sonar
Change only the SDKbase_url / baseURL to https://api.aisonar.dev/v1, keep your existing OpenAI API key environment variable name if that is easier for rollout, and replace model IDs after checking GET /v1/models.
OpenRouter to AI Sonar
Usehttps://api.aisonar.dev/v1 where your app previously used OpenRouter’s OpenAI-compatible base URL. Remove provider-prefixed model IDs and use AI Sonar public model IDs from /v1/models; when a workload needs Claude Messages or Gemini generateContent, move it to the native AI Sonar endpoint instead of forcing it through OpenAI-compatible chat.
LiteLLM to AI Sonar
Use LiteLLM’scustom_openai/<model> route with api_base: https://api.aisonar.dev/v1. Keep LiteLLM aliases separate from real AI Sonar model IDs so you can change routing policy without changing application prompts.
Claude Messages via AI Sonar
Point Anthropic SDK clients athttps://api.aisonar.dev and call messages.create. Do not append /v1 to the SDK base URL; the SDK owns the /v1/messages path.
Gemini Native via AI Sonar
Keep Gemini payloads onhttps://api.aisonar.dev/v1beta/models/{model}:generateContent. Gemini-native contents, parts, files, cached contents, function declarations, and built-in tools should stay on this route when your app depends on Gemini behavior.
OpenAI-Compatible Migration
GET /v1/models before production traffic. For image generation, send model explicitly and read the image guide because image models differ more than chat models.
Anthropic Migration
/v1/messages for Claude-native tool use, thinking flows, and Anthropic message semantics. Do not translate Anthropic-only fields through Chat Completions unless you intentionally want an OpenAI-compatible behavior change.
Gemini Migration
/v1beta when your app depends on Gemini-native behavior.
Media Migration
- Query
GET /v1/models?recommended_for=image|video|music|3d. - Read
GET /v1/modelsin list responses and the fullGET /v1/models/{model}where available. - Send an explicit
model, especially for image endpoints. - Store
task_id,poll_url, endpoint, model, and your own job ID for async jobs. - Reconcile costs through usage records and
billing_transaction_id, not provider task IDs.
Production Rollout Plan
Migration Pitfalls
- Do not put every model behind one OpenAI Chat Completions path if your app needs native Anthropic, Gemini, or Responses behavior.
- Do not assume old image defaults. Send
modelexplicitly. - Do not retry async create requests without checking whether a task was already created.
- Do not expose provider-specific identifiers in your logs or UI.
- Do not compare billing with provider task IDs. Use AI Sonar usage records.