Base URL
All API requests are sent to:Authentication
Include your API key in theAuthorization header of every request:
Content type
SetContent-Type: application/json on all requests that include a body. Multipart file upload endpoints (audio transcription, audio translation, image edits, and image variations) use multipart/form-data instead.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /v1/chat/completions | Chat completions — OpenAI-compatible chat interface |
POST | /v1/responses | Responses — OpenAI Responses API format |
POST | /v1/responses/compact | Responses (compact) — Returns output text only |
POST | /v1/messages | Messages — Anthropic-compatible messages interface |
GET | /v1beta/models | Models — List all available models |
POST | /v1/embeddings | Embeddings — Generate text embeddings |
POST | /v1/rerank | Rerank — Rerank documents by relevance |
POST | /v1/images/generations | Image generation — Generate images from a prompt |
POST | /v1/images/edits | Image edits — Edit an image with a prompt and mask |
POST | /v1/images/variations | Image variations — Create variations of an image |
POST | /v1/audio/speech | Text-to-speech — Synthesize speech from text |
POST | /v1/audio/transcriptions | Transcription — Transcribe audio to text |
POST | /v1/audio/translations | Translation — Translate audio to English text |
Error codes
TokModel returns standard HTTP status codes. When a request fails, the response body contains anerror object with a message field describing the problem.
| Status | Name | Description |
|---|---|---|
400 | Bad Request | The request body is malformed or a required parameter is missing. |
401 | Unauthorized | The Authorization header is absent or the API key is invalid. |
403 | Forbidden | Your API key is valid but your account has insufficient credits to complete the request. |
404 | Not Found | The requested endpoint or resource does not exist. |
429 | Too Many Requests | You have exceeded the rate limit. Back off and retry after a short delay. |
500 | Internal Server Error | An unexpected error occurred on TokModel’s servers. Retry the request. |
