API overview
primerouter exposes a REST API fully compatible with OpenAI, plus native support for Anthropic Messages and Google Gemini.
Base URL
https://primerouter.aiOpenAI-style endpoints are under /v1/.... Claude-style endpoints are listed in API Reference.
Authentication
Authorization: Bearer sk-your-keyOr Anthropic-style:
x-api-key: sk-your-keyGet a key: log in → Tokens → create.
Main endpoints
| Endpoint | Use |
|---|---|
POST /v1/chat/completions | Multi-turn chat (OpenAI-compatible, most common) |
POST /v1/responses | OpenAI Responses API |
POST /v1/messages | Anthropic Messages (native Claude) |
POST /v1/embeddings | Vector embeddings |
POST /v1/images/generations | Text to image |
POST /v1/images/edits | Image editing, multiple reference images |
POST /v1/audio/speech | TTS |
POST /v1/audio/transcriptions | Whisper STT |
GET /v1/models | List models |
POST /v1/rerank | Document reranking |
Full schema and examples: API Reference (interactive viewer).
Sub-topics
- Authentication — key types, expiry, IP allowlist
- Streaming — SSE protocol details
- Error codes — standard error structure and handling
- Images — multiple reference images, size/quality limits, per-image billing
- Image Generation Skill — website download, cross-agent installation, and usage
- API Reference — interactive endpoint browser (try it live)
SDKs and examples
primerouter does not ship a dedicated SDK — the goal is for you to keep using your existing SDK. See Migrate from OpenAI SDK.
Rate limits
Each API key is bound by:
- User-level RPM / TPM (depends on your group)
- Model-level RPM (some models have upstream limits)
Hitting the limit returns 429 Too Many Requests with a Retry-After header. See Error codes.
