https://api.aciemind.com/v1;Claude / Anthropic 協議用 https://api.aciemind.com。
看 SDK 設定 →
新的預付額度與付費預付卡目前暫停。既有 API 用量、交易與 legacy 額度仍可查詢;平台正在準備訂閱與用量結算,正式開放前會先公開價格、續約、取消、退款與發票規則。
OpenAI 相容 API;一組 sk-cafe- 金鑰,集中管理模型路由、用量紀錄與服務帳務。為人類開發者與 AI Agent 設計。
如果你只是想先測通,照這四格走:先確認 Base URL,再拿 Key、選模型、看錯誤碼。這能避開大多數 401 / 402 / 429 的客服來回。
https://api.aciemind.com/v1;Claude / Anthropic 協議用 https://api.aciemind.com。
看 SDK 設定 →
sk-cafe-。Key 只顯示一次;遺失請重新建立,不要貼到公開 repo。
前往帳號中心 →
最小測試命令:
curl https://api.aciemind.com/v1/chat/completions \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"MiniMax-M3","messages":[{"role":"user","content":"ping"}]}'
測通 API 只是第一步。真正上線前,要先把成本、限流、回滾與客服證據準備好;這樣就算 coding agent 或自動化流程突然放大,也能先止血再排錯。
x-cafe-channel 與用量/quota header。
Base URL: https://api.aciemind.com/v1
API Key: sk-cafe-...(帳號中心建立,或 Agent 用 POST /api/agent/register 自助取得)
from openai import OpenAI
client = OpenAI(base_url="https://api.aciemind.com/v1", api_key="sk-cafe-...")
r = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "你好"}],
)
print(r.choices[0].message.content)
curl https://api.aciemind.com/v1/chat/completions \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"MiniMax-M3","messages":[{"role":"user","content":"ping"}]}'
不用改程式碼的其他部分,只需要換 base_url 和 api_key。Model ID 用短名稱(見模型目錄),不用 provider 前綴。
如果你要接 Cursor、Claude Code、Codex、Cline、Continue、Cherry Studio 等編程工具,請看 編程工具接入文件。
Authorization: Bearer sk-cafe-...。金鑰只在建立/註冊當下顯示一次,請立即保存;遺失只能重新建立。
| Header | 說明 |
|---|---|
x-cafe-channel | 本次請求實際使用的上游通道名稱 |
x-cafe-credit-remaining | legacy 額度剩餘值(mTWD;÷1000 = NT$),只供既有帳務相容 |
x-cafe-quota-remaining | token 硬上限模式下的剩餘額度(quota_tokens > 0 時才有意義) |
x-cafe-ratelimit-limit-requests | 每分鐘請求數上限(RPM) |
x-cafe-ratelimit-remaining-requests | 本分鐘視窗剩餘請求數 |
| 層級 | RPM | 每日次數 | 備註 |
|---|---|---|---|
| 一般 token(預設) | 60 | 依帳務/用量方案 | 建立 token 時可調整 |
| Agent 自助註冊 | 30 | rpd 上限 1000 | 保守配額,防單一 agent 失控 |
看到錯誤時先不要重試到爆。用 status / code 決定下一步;Gateway 會在可恢復錯誤回傳 x-cafe-recovery-action、x-cafe-recovery-url,body 也會有 recovery.action / recovery.url。保留 x-cafe-channel、model、token prefix 與 Usage 列,客服才能快速對帳。
shrink_request 或 tune_token_quota,降低並發、縮小 max_tokens,或到 Tokens 調整限制。
調整限制
| 狀態碼 | code | 說明 |
|---|---|---|
| 400 | — | 請求格式錯誤(無效 JSON、缺必填欄位) |
| 401 | invalid_token | API Key 遺失、無效 |
| 402 | insufficient_credits | 既有 legacy 額度不足;新預付額度目前暫停 |
| 403 | token_disabled / model_not_allowed / agent_register_code_required | token 已停用、模型不在白名單,或 agent 註冊碼缺失/錯誤 |
| 409 | model_pricing_missing | 模型缺少現行定價,平台已暫停請求以避免漏收費;請換模型或聯絡客服。 |
| 404 | — | 該 model 沒有設定可用 channel |
| 429 | quota_exhausted / agent_register_ip_limit | 硬上限用罄或 agent 註冊防刷 |
| 502 | — | 所有上游 channel 皆失敗(含自動 fallback 後) |
| 503 | agent_register_site_limit | 全站 agent 註冊今日名額已滿 |
| 方法 | 路徑 | 說明 |
|---|---|---|
| POST | /api/agent/register | Agent 自助註冊,公開端點,發限時體驗 API Key 與非現金試用權益 |
| POST | /v1/chat/completions | Chat(主要端點,支援 stream、tools) |
| POST | /v1/messages | Anthropic 相容(Claude Code / ZCode 等原生 Claude 協議客戶端) |
| POST | /v1/embeddings | Embeddings(需模型有 route) |
| POST | /v1/images/generations | 圖像生成(需模型有 route) |
| POST / GET | /v1/videos/generations/v1/videos/generations/{id} | 影片建立與非同步輪詢(需影片能力包) |
| GET | /v1/models | 此 token 可用模型(依白名單過濾) |
| GET | /api/public/models | 公開模型清單 + 定價(免驗證) |
| GET | /api/public/catalog | 公開完整目錄(含 capabilities / modalities / provider) |
| POST | /api/redeem | CAFE- 限時體驗碼;付費 TC- 預付卡兌換目前暫停 |
POST /v1/chat/completions{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "..."}],
"stream": false,
"tools": [ /* OpenAI function-calling 格式,選填 */ ]
}
回傳 usage.total_tokens 用來換算成本;stream:true 時走 SSE,串流結束後才在背景結算扣款。
POST /v1/messages(Anthropic 相容)金鑰放 x-api-key(Anthropic 慣例),也接受 Authorization: Bearer。完整支援 tool_use 雙向轉換,串流回合規 Anthropic SSE。詳見下方「SDK 參考」的 Claude Code 設定。
圖像模型請以 公開目錄 為準(按張計費,需已啟用路由):
curl https://api.aciemind.com/v1/images/generations \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"z-image-turbo","prompt":"一隻在咖啡廳寫程式的貓","n":1,"size":"1024x1024"}'
計費以生成張數為準;回應 header x-cafe-channel 顯示實際上游。
影片統一使用非同步介面:先建立工作,再依回傳的 id 輪詢。HappyHorse、Veo、Sora、Grok、Seedance、CogVideoX 的官方 API 差異已由平台路由層處理;MiniMax 既有 Token Plan 官方路徑保留不變。
curl https://api.aciemind.com/v1/videos/generations \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"happyhorse-1.1-t2v","prompt":"一匹快樂的馬在海邊奔跑","duration":5,"resolution":"720P"}'
curl https://api.aciemind.com/v1/videos/generations/{id} \
-H "Authorization: Bearer sk-cafe-..."
狀態會是 queued、in_progress、completed 或 failed;完成後從 data[0].url 取得影片。影片 URL 可能受上游有效期限制,建議完成後立即轉存到自己的物件儲存。
| 廠商 | 目前主推模型 | 平台介接 | 官方文件 |
|---|---|---|---|
| OpenAI / ChatGPT | gpt-image-2、sora-2、sora-2-pro | Image API;Sora /v1/videos 非同步 | GPT Image 2 · Sora 2 |
| Google Gemini | gemini-3.1-flash-image、veo-3.1-generate-preview、veo-3.1-fast-generate-preview | Interactions;Veo predictLongRunning | 圖片 · Veo |
| 千問/通義 | qwen-image-2.0-pro、happyhorse-1.1-t2v/i2v/r2v | DashScope 原生;影片非同步 | 圖片模型 · HappyHorse T2V |
| Grok / xAI | grok-imagine-image-quality、grok-imagine-video、grok-imagine-video-1.5 | Images 相容;影片 request_id 輪詢 | Imagine · Video |
| 智譜 GLM | glm-image、cogvideox-3 | 圖片相容;影片 async-result 輪詢 | GLM-Image · CogVideoX-3 |
| 豆包/火山方舟 | doubao-seedream-5-0-lite-260128、doubao-seedance-1-5-pro-251215 | Seedream 相容;Seedance contents task | Seedream · Seedance API |
| MiniMax | 既有 image-01、image-01-live、Hailuo 2.3 | 維持現有官方 Token Plan 路徑 | 圖片 · 影片 |
| DeepSeek/Kimi/LongCat/MiMo/Claude | 目前官方文件只提供文字、理解或視覺輸入,沒有公開原生生圖/生影片輸出模型 | 暫不建立虛假媒體 route | DeepSeek · Kimi · LongCat · Claude Vision |
目錄中的價格是平台對外計價,不等同上游帳單;美元/人民幣模型依官方公開價換算後加上平台服務係數,Ark 等依帳戶、地區、解析度或套餐扣點的項目會在模型備註中標示。
Embeddings 模型請以公開目錄為準;若 text-embedding-3-small 有啟用路由可直接呼叫:
curl https://api.aciemind.com/v1/embeddings \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"text-embedding-3-small","input":"Token Cafe embedding test"}'
回應 header x-cafe-channel 顯示實際上游;計費以 prompt token 為主。
POST /api/agent/registercurl -X POST https://api.aciemind.com/api/agent/register \
-H "Content-Type: application/json" \
-d '{"name": "my-agent"}' # body 選填
{
"ok": true,
"api_key": "sk-cafe-...",
"endpoint": "https://api.aciemind.com/v1/chat/completions",
"trial_ntd": null,
"trial_entitlement": { "kind": "promotional_usage", "cash_value_twd": 0, "expires_in_days": 7 },
"limits": { "rpm": 30, "rpd": 1000, "max_concurrency": 2 }
}
api_key 只回傳這一次,收到後立即保存。防刷限制:同 IP 24 小時內限 2 次、全站每日 50 次。未完成正式綁定且 14 天未使用的 agent 帳號會由每日排程自動 closed。若站點設定了 AGENT_REGISTER_CODE,需在 body 帶 invite_code 或 header X-Agent-Register-Code。
完全相容 OpenAI SDK 生態——只需更改 base_url 與 api_key,其餘程式碼不變。
from openai import OpenAI
client = OpenAI(base_url="https://api.aciemind.com/v1", api_key="sk-cafe-...")
resp = client.chat.completions.create(model="gpt-4o-mini", messages=[...])
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.aciemind.com/v1", apiKey: "sk-cafe-..." });
const resp = await client.chat.completions.create({ model: "gpt-4o-mini", messages: [...] });
# Anthropic Python/TS SDK
base_url="https://api.aciemind.com", api_key="sk-cafe-..."
# Claude Code CLI
export ANTHROPIC_BASE_URL=https://api.aciemind.com
export ANTHROPIC_API_KEY=sk-cafe-...
https://api.aciemind.com/v1aider --openai-api-base https://api.aciemind.com/v1 --openai-api-key sk-cafe-...from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="https://api.aciemind.com/v1", api_key="sk-cafe-...", model="gpt-4o-mini")
Token Cafe 對 agent 沒有登入介面、沒有人工審批——自助註冊、標準 Bearer 金鑰,任何支援 OpenAI API 的框架都能直接接。
# Step 1:申請 Key(一次性,全程無人工介入)
curl -X POST https://api.aciemind.com/api/agent/register -d '{}'
# → { "api_key": "sk-cafe-...", "trial_ntd": null, "trial_entitlement": { ... }, ... }
# Step 2:用試用金呼叫公開模型(依用量扣款)
curl https://api.aciemind.com/v1/chat/completions \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"MiniMax-M3","messages":[{"role":"user","content":"hello"}]}'
# Step 3:需要 Claude / GPT 等更強模型時,依正式付款方案使用
curl https://api.aciemind.com/v1/chat/completions \
-H "Authorization: Bearer sk-cafe-..." \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5","messages":[{"role":"user","content":"hello"}]}'
請使用 公開模型目錄 中的短 ID(例如 MiniMax-M3、gpt-4o-mini)。Agent 先取得限時體驗額度;正式方案會依公開價格與實際用量結算,新的預付額度目前暫停。
把 skill.md 餵給 Claude / Cursor / Copilot 等助理,它就能自己理解 Token Cafe 的接入方式,不需要你手動貼程式碼片段。
curl -s https://token.aciemind.com/skill.md
# CrewAI(透過 langchain_openai)
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="https://api.aciemind.com/v1", api_key="sk-cafe-...", model="claude-haiku-4-5")
# AutoGen
config_list = [{
"model": "claude-haiku-4-5",
"base_url": "https://api.aciemind.com/v1",
"api_key": "sk-cafe-...",
}]
任何支援 base_url + api_key 自訂端點的 agent 框架都適用同一模式。
帳號中心 Dashboard「計費驗證 Probe」提供兩種模式: