Clew API Docs
AI provider gateway — route requests through api.clew-code.org with usage tracking, API key auth, and rate limiting.
Base URL: https://api.clew-code.org
Introduction
Clew API provides unified access to multiple AI providers (DeepSeek, OpenAI, Groq, Mistral, etc.) through a single OpenAI-compatible endpoint. It handles authentication, rate limiting, usage tracking, and billing.
Quick Start
# 1. Create account curl -X POST https://api.clew-code.org/v1/auth/signup \ -H "Content-Type: application/json" \ -d '{"email":"[email protected]","password":"yourpassword"}' # 2. Login to get token TOKEN=$(curl -s -X POST https://api.clew-code.org/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"[email protected]","password":"yourpassword"}' \ | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])") # 3. Call DeepSeek curl -X POST https://api.clew-code.org/v1/chat/completions \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"Hello!"}]}'
Authentication
Two authentication methods:
| Method | Header | Use Case |
|---|---|---|
| Bearer Token | Authorization: Bearer <token> | Dashboard & personal use (from login) |
| API Key | X-API-Key: <key> | Programmatic access (created in dashboard) |
Sign Up
Login
Get Profile
Password Reset
Models
Supported models:
| Model | Provider | Context | Pricing |
|---|---|---|---|
| deepseek-v4-pro | DeepSeek | 1M | $1.50/$4 per 1M |
| deepseek-v4 | DeepSeek | 1M | $0.50/$1.50 per 1M |
| gpt-5.5 | OpenAI | 1M | $10/$40 per 1M |
| groq/llama4 | Groq | 100K | $0.50/$1 per 1M |
| mistral/large | Mistral | 128K | $2/$6 per 1M |
Chat Completions
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Model ID from /v1/models |
| messages | array | yes | Array of {role, content} objects |
| stream | boolean | no | Enable SSE streaming |
| max_tokens | number | no | Max tokens in response |
Non-Streaming Example
curl -X POST https://api.clew-code.org/v1/chat/completions \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"Hello!"}]}'
Streaming Example
curl -X POST https://api.clew-code.org/v1/chat/completions \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"Hello!"}],"stream":true}'
Response headers include:
X-RateLimit-Limit— Max requests per minuteX-RateLimit-Remaining— Requests remaining in current windowX-Cost-USD— Cost of the request in USDX-Tier— Your account tier (free/pro/enterprise)X-Key-Source—pool(our key) orbyok(your key)
Free Auto-Routing
Use clew/free to automatically route to the best available free model. Falls back if rate limited.
curl -X POST https://api.clew-code.org/v1/chat/completions \ -H "Authorization: Bearer $TOKEN" \ -d '{"model":"clew/free","messages":[{"role":"user","content":"Hello!"}]}'
OCR — Extract Text from Images
Use clew/ocr to extract text from images. Supports Thai and English. Auto-routes through DeepSeek OCR, NVIDIA VL, or Groq Vision.
curl -X POST https://api.clew-code.org/v1/chat/completions \ -H "Authorization: Bearer $TOKEN" \ -d '{"model":"clew/ocr","messages":[{"role":"user","content":[{"type":"image_url","image_url":{"url":"https://example.com/document.jpg"}}]}]}'
Choose model: clew/ocr/nvidia, clew/ocr/deepseek
clew/ Prefix
Prefix any model with clew/ — automatically resolves to the correct provider. Browse all 500+ models on the Models page.
# These are equivalent:
{"model":"gpt-4o-mini"}
{"model":"clew/gpt-4o-mini"}
Image Generation
Supported models: minimax-image-01, dall-e-3
curl -X POST https://api.clew-code.org/v1/images/generations \ -H "Authorization: Bearer $TOKEN" \ -d '{"model":"minimax-image-01","prompt":"a cute cat"}'
Video Generation
Supported models: minimax-hailuo-2.3
curl -X POST https://api.clew-code.org/v1/video/generations \ -H "Authorization: Bearer $TOKEN" \ -d '{"model":"minimax-hailuo-2.3","prompt":"a cat walking in the park"}'
API Keys
Usage
Billing
Telemetry
Anonymous endpoints for Clew Code CLI instances to report usage.
Webhooks
Plugins
Updates
Pricing
| Tier | Price | Rate Limit | Token Limit/Month |
|---|---|---|---|
| Free | $0 | 10 req/min | 100K tokens |
| Pro | $10/mo | 100 req/min | 5M tokens |
| Enterprise | $100/mo | 1000 req/min | Unlimited |
Dashboard
Manage your account at clew-code.org/app/ — view usage, create API keys, manage billing, and more.