API mapping
Quick Migration Recipes
OpenAI to TokenLab
Change the SDKbase_url / baseURL to https://api.tokenlab.sh/v1, replace the API key, and choose a model ID from GET /v1/models.
OpenRouter to TokenLab
Replace the OpenRouter base URL withhttps://api.tokenlab.sh/v1. TokenLab model IDs do not include an OpenRouter provider prefix. Use Anthropic Messages or Gemini only when your application needs fields from those formats.
LiteLLM to TokenLab
Use LiteLLM’scustom_openai/<model> configuration with api_base: https://api.tokenlab.sh/v1. Keep your LiteLLM alias separate from the TokenLab model ID so either can change without editing application prompts.
Claude Messages via TokenLab
Point Anthropic SDK clients athttps://api.tokenlab.sh and call messages.create. Do not append /v1 to the SDK base URL; the SDK owns the /v1/messages path.
Gemini Native via TokenLab
Keep Gemini payloads onhttps://api.tokenlab.sh/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. Image requests must include a model explicitly; see the image guide for model-specific inputs.
Anthropic Migration
/v1/messages for Claude tool calls, thinking blocks, and Anthropic message fields. Chat Completions does not guarantee those fields.
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.
task_id and poll_url before replacing an existing integration. A create-request timeout must not produce a second user job.
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.
- Use TokenLab task IDs and usage records in your product. Third-party task IDs are not billing identifiers.