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

MethodEndpointDescription
GET/v1/modelsList available models
GET/health/readyHealth check (no auth)

Error Codes

CodeMeaningAction
401Invalid or missing API keyCheck your toc- key
402Quota exhaustedWait for window reset or upgrade plan
429Rate limit exceededWait and retry, or upgrade plan
503Service overloadedRetry shortly
Contact Sales (Telegram)