Tài liệu
Mọi thứ bạn cần để bắt đầu
API Reference
Techopenclaw exposes three endpoints matching the OpenAI and Anthropic API formats. All endpoints require authentication via API key.
POST/v1/chat/completionsOpenAI
Standard OpenAI Chat Completions format. Works with all models.
curl
curl https://api.techopenclaw.com/v1/chat/completions \
-H "Authorization: Bearer toc-....." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.3",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
],
"max_tokens": 4096,
"stream": true
}'Streaming: Set stream: true for SSE responses. Add "stream_options": { "include_usage": true } for token usage in stream.
POST/v1/messagesAnthropic
Native Anthropic Messages format. Used by Claude Code and tools that speak the Anthropic API.
curl
curl https://api.techopenclaw.com/v1/messages \
-H "x-api-key: toc-....." \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "gpt-5.3",
"messages": [
{ "role": "user", "content": "Hello!" }
],
"system": "You are a helpful assistant.",
"max_tokens": 4096,
"stream": true
}'Extended thinking: Supported via the thinking parameter.
POST/v1/responsesOpenAI
OpenAI Responses API format. Used for GPT and Codex models.
curl
curl https://api.techopenclaw.com/v1/responses \
-H "Authorization: Bearer toc-....." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.3-codex",
"input": [
{ "role": "user", "content": [{ "type": "input_text", "text": "Hello!" }] }
],
"stream": true,
"reasoning": { "effort": "high" }
}'Other Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/models | List available models |
| GET | /health/ready | Health check (no auth) |
Error Codes
| Code | Meaning | Action |
|---|---|---|
401 | Invalid or missing API key | Check your toc- key |
402 | Quota exhausted | Wait for window reset or upgrade plan |
429 | Rate limit exceeded | Wait and retry, or upgrade plan |
503 | Service overloaded | Retry shortly |