SwitchLLM

API reference

Authentication

Every request carries your key as a bearer token. Keys are per project and can be revoked at any moment.

Authorization: Bearer $SWITCHLLM_KEY
Content-Type: application/json

Never ship a key inside client-side code. If one leaks, revoke it in the console and create a new one.

Endpoints

Base URL: https://switchllm.net/v1

MethodPathPurpose
POST/v1/chat/completionsChat completions. Works with the OpenAI SDKs and most desktop clients.
POST/v1/responsesResponses API format, for clients built on that shape.
POST/v1/messagesMessages format, for clients that speak it.
GET/v1/modelsList the models your key can reach.

Which endpoints answer depends on the model source behind each model. GET /v1/models and the console are always the source of truth.

Errors

CodeMeaningWhat to do
401Missing, wrong or revoked keyCheck the Authorization header, or create a new key in the console.
402Balance or monthly cap used upTop up, or raise the cap on that key.
404Unknown model idCopy the exact id from the console or from GET /v1/models.
429Rate or concurrency limit hitBack off and retry. Concurrency depends on your plan.
5xxA model source failedRetry. Traffic is moved to another source automatically.

Limits

  • Each key has its own monthly cap; when it is reached, requests stop instead of overspending.
  • Concurrency depends on your plan. Streaming is supported on every chat endpoint.
  • Usage and balance are in the console, per key and per day.

← Docs