Bắt đầu nhanh
Call multiple models with one key through OpenAI- and Anthropic-compatible APIs. This page covers authentication, streaming, model selection and error handling.
Tương thích với OpenAI SDK · Anthropic SDK · cURL
Bước 1 — Đăng ký & nhận tín dụng miễn phí
Bước 2 — Tạo API key
Bước 3 — Đặt base URL của bạn
https://aaa.ashp.tw/v1
https://aaa.ashp.tw/v1/anthropic
Bước 4 — Gửi yêu cầu đầu tiên
curl https://aaa.ashp.tw/v1/chat/completions \
-H "Authorization: Bearer $AAA_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Gửi API key của riêng bạn (bắt đầu bằng sk-) dưới dạng Bearer token trong header Authorization.
API reference
Authentication
Every request must include your API key (it starts with sk-). On OpenAI-compatible endpoints, send it in the Authorization: Bearer header; on Anthropic-compatible endpoints you can also use the x-api-key header. Keep your key secret and never put it in client-side code or public repositories.
Authorization: Bearer $AAA_TOKEN_API_KEY
Streaming
Add stream: true to your request to receive output incrementally over Server-Sent Events (SSE), which suits chat interfaces and long responses. Streaming is supported on both the OpenAI-compatible /v1/chat/completions and the Anthropic-compatible /v1/messages.
Models and pricing
Set the model field of your request to a model name, such as claude-sonnet-4-6 or gpt-5.4. See the pricing page for available models and their per-million-token prices.
Error codes
| HTTP | Type |
|---|---|
401 | The API key is missing, invalid or has been revoked. Check that your key is correct. |
402 | Insufficient balance. Top up your account and try again. |
404 | The requested path or model was not found. Check the base URL, the path and the model name. |
429 | Too many requests: a rate limit was hit. Wait a moment and retry with exponential backoff. |
500+ | A temporary error or timeout occurred at the upstream model provider. Retry shortly; if it persists, contact [email protected]. |
Video generation API (Seedance)
Generate AI video with the same API key. Creating a task returns a task ID immediately; poll it with GET until it returns the video URL. The native Ark path /v1/contents/generations/tasks is also supported.
curl https://aaa.ashp.tw/v1/videos/generations \
-H "Authorization: Bearer $AAA_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-1-5-pro-251215",
"content": [{"type": "text", "text": "A golden dragon flying over a neon city at night"}],
"resolution": "720p",
"duration": 5,
"ratio": "16:9"
}'
curl https://aaa.ashp.tw/v1/videos/generations/vid_xxxxxxxxxxxxxxxxxxxxxxxx \
-H "Authorization: Bearer $AAA_TOKEN_API_KEY"
Billing: you are charged only when the video succeeds — cost = video tokens × model price, where video tokens ≈ width × height × fps × seconds ÷ 1024. Failed or cancelled tasks are free. Video URLs expire after about 24 hours, so download promptly.
Per-key limits
Each API key can have its own total and daily spend caps, model allowlist, IP allowlist, expiry and requests-per-minute limit, set in your dashboard — so you can safely hand keys to teammates, clients or servers. When a limit is hit you get:
| HTTP | Type |
|---|---|
401 | key_expired — the key has expired |
402 | key_spend_limit — the key reached its total spend cap |
403 | model_not_allowed / ip_not_allowed — the model or source IP is not on the key’s allowlist |
429 | key_daily_limit / key_rate_limit — the daily spend cap or per-minute limit was reached |
Model list
GET /v1/models returns every model currently available (OpenAI format), ready for tools like Cursor and Cline.
curl https://aaa.ashp.tw/v1/models -H "Authorization: Bearer $AAA_TOKEN_API_KEY"