API Reference
Endpoints, authentication, and examples for the TokAPI gateway.
Base URL
https://api.tokapi.aiAuthentication
Send your TokAPI key as a Bearer token:
Authorization: Bearer sk-lazytech-...The x-api-key: sk-lazytech-... header is also accepted. Public endpoints
require no authentication.
Public endpoints
No authentication required.
| Method | Path | Description |
|---|---|---|
| GET | /v1/ping | Health check. |
| GET | /v1/models | List the full model catalog. |
| GET | /v1/models/{model} | Retrieve a single model. |
OpenAI-compatible endpoints
Require a Bearer key.
| Method | Path | Description |
|---|---|---|
| POST | /v1/responses | Create a response (Responses API). |
| GET | /v1/responses/{response_id} | Retrieve a response. |
| POST | /v1/chat/completions | Chat Completions API. |
| POST | /v1/conversations | Create a conversation. |
| GET | /v1/conversations/{conversation_id} | Retrieve a conversation. |
| POST | /v1/conversations/{conversation_id} | Update a conversation. |
| DELETE | /v1/conversations/{conversation_id} | Delete a conversation. |
Claude-compatible endpoints
Require a Bearer key.
| Method | Path | Description |
|---|---|---|
| POST | /v1/messages | Anthropic Messages API. |
| POST | /v1/messages/count_tokens | Count tokens for a message request. |
Files
Require a Bearer key.
| Method | Path | Description |
|---|---|---|
| POST | /v1/files | Upload a file (multipart). |
| PUT | /v1/files/{path} | Upload/replace a file (streaming body). |
Usage
Require a Bearer key.
| Method | Path | Description |
|---|---|---|
| GET | /v1/usage | Budget usage as percentages. See Usage API. |
Example — POST /v1/responses
curl https://api.tokapi.ai/v1/responses \
-H "Authorization: Bearer sk-lazytech-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "Summarize the theory of relativity in one sentence."
}'Example — POST /v1/messages
curl https://api.tokapi.ai/v1/messages \
-H "Authorization: Bearer sk-lazytech-..." \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello, Claude!" }]
}'Set "stream": true on either endpoint to receive Server-Sent Events.
Error codes
| Status | Meaning |
|---|---|
| 400 | Invalid request body or model. |
| 401 | Missing or invalid API key. |
| 402 | Budget or rate window exhausted. |
| 403 | Key disabled, expired, or not permitted. |
| 404 | Resource not found. |
| 429 | Rate limited. |
| 500 | Server error. |
| 502 | Upstream provider failure. |
| 503 | Feature or capacity unavailable. |