Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tokmodel.com/llms.txt

Use this file to discover all available pages before exploring further.

TokModel exposes a single base URL through which you can reach every supported endpoint. All requests require a TokModel API key, and all request and response bodies use JSON. The sections below describe the connection details, list every available endpoint, and document the error codes you may encounter.

Base URL

All API requests are sent to:
https://tokmodel.com

Authentication

Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY
You can create and manage API keys from the TokModel console.

Content type

Set Content-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

MethodPathDescription
POST/v1/chat/completionsChat completions — OpenAI-compatible chat interface
POST/v1/responsesResponses — OpenAI Responses API format
POST/v1/responses/compactResponses (compact) — Returns output text only
POST/v1/messagesMessages — Anthropic-compatible messages interface
GET/v1beta/modelsModels — List all available models
POST/v1/embeddingsEmbeddings — Generate text embeddings
POST/v1/rerankRerank — Rerank documents by relevance
POST/v1/images/generationsImage generation — Generate images from a prompt
POST/v1/images/editsImage edits — Edit an image with a prompt and mask
POST/v1/images/variationsImage variations — Create variations of an image
POST/v1/audio/speechText-to-speech — Synthesize speech from text
POST/v1/audio/transcriptionsTranscription — Transcribe audio to text
POST/v1/audio/translationsTranslation — Translate audio to English text

Error codes

TokModel returns standard HTTP status codes. When a request fails, the response body contains an error object with a message field describing the problem.
StatusNameDescription
400Bad RequestThe request body is malformed or a required parameter is missing.
401UnauthorizedThe Authorization header is absent or the API key is invalid.
403ForbiddenYour API key is valid but your account has insufficient credits to complete the request.
404Not FoundThe requested endpoint or resource does not exist.
429Too Many RequestsYou have exceeded the rate limit. Back off and retry after a short delay.
500Internal Server ErrorAn unexpected error occurred on TokModel’s servers. Retry the request.

Example error response

{
  "error": {
    "message": "Invalid API key provided.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}