TokensClub documentation

API 接口與範例

協議要與所選模型及渠道相符。下方使用完整請求 URL;不要把控制台頁面當作接口地址。

協議完整端點
Chat CompletionsPOST /v1/chat/completions
ResponsesPOST /v1/responses
Anthropic MessagesPOST /v1/messages

Chat Completions

curl https://tokensclub.top/v1/chat/completions \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_ENABLED_MODEL","messages":[{"role":"user","content":"只回覆 OK"}]}' 

Responses

curl https://tokensclub.top/v1/responses \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_ENABLED_MODEL",
    "input": "Hello, TokensClub."
  }'

圖片生成(1K)

GPT 圖片模型目前只驗收 size=1024x1024(1K)的請求設定,按成功輸出張數計費。實際回傳尺寸可能不同;需要固定尺寸時請先檢查圖片。請使用 GPT 分組的 API Key;其他尺寸或品質設定尚未驗收。

curl https://tokensclub.top/v1/images/generations   -H "Authorization: Bearer $TOKENSCLUB_API_KEY"   -H "Content-Type: application/json"   -d '{"model":"gpt-image-1","prompt":"A blue circle on white","n":1,"size":"1024x1024"}'

全能生圖 API

在本站 API 金鑰頁選擇「全能生圖」分組。Base URL 為 https://tokensclub.top/v1;文生圖使用 POST /v1/images/generations,參考圖編輯使用 POST /v1/images/edits。model 必須填寫價目表中的完整名稱。

建立本站 API Key · 查看模型、價格及參考圖上限

gpt-image-2.6 已完成付費生成、多張參考圖編輯及結算驗收。其他模型仍只有隔離計費驗證。逾時或結果未確認時,請先查使用記錄,勿自動重試。

必須提供下表中的 size;檔位以請求尺寸選擇,不按回傳像素重新定價。n 為 1–15 的整數,預設 1。只支援非串流、quality=auto 及 PNG 輸出;response_format 可選 url 或 b64_json。其他參數會明確拒絕,不會自動刪除或替換。

其他圖片模型尺寸表

比例1K2K4K
1:11024x10242048x20483840x3840
16:91280x7202560x14403840x2160
9:16720x12801440x25602160x3840
3:21536x10243072x20483840x2560
2:31024x15362048x30722560x3840
4:31344x10082688x20163840x2880
3:41008x13442016x26882880x3840
5:41280x10242560x20483840x3072
4:51024x12802048x25603072x3840
21:91792x7683136x13444032x1728

實際可選尺寸仍受模型限制:-fb 的 1K 只支援 1:1、4:3、3:4、2:3、9:16、16:9,2K/4K 只支援 16:9,亦不支援參考圖。Lite 只支援 1K,Firefly 不支援 4K。

curl https://tokensclub.top/v1/images/generations \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"model": "gpt-image-2", "prompt": "A blue circle on white", "size": "1024x1024", "n": 1, "quality": "auto"}'

參考圖編輯使用 multipart/form-data;image 或 image[] 放 PNG、JPEG 或 WebP 檔案。請遵守表內張數上限,整個請求最多 64 MiB。

curl https://tokensclub.top/v1/images/edits \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -F model=gpt-image-2 \
  -F prompt="Use a clean studio background" \
  -F size=2048x2048 \
  -F n=1 \
  -F "image=@/absolute/path/reference.png"

gpt-image-2.6

只支援下表列出的尺寸,按本站尺寸檔位及成功張數計費。4K 正方形為 4096×4096;參考圖編輯每次最多 5 張。

檔位比例size
1K1:11024x1024
1K3:21536x1024
1K2:31024x1536
1K3:41008x1344
1K9:16720x1280
1K16:91280x720
2K1:12048x2048
2K16:92560x1440
4K1:14096x4096
4K16:93840x2160
curl https://tokensclub.top/v1/images/generations \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"model": "gpt-image-2.6", "prompt": "A red cube on a white table", "size": "1024x1024", "n": 1, "quality": "auto", "output_format": "png"}'
curl https://tokensclub.top/v1/images/edits \
  -H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
  -F model=gpt-image-2.6 \
  -F prompt="make the cube blue" \
  -F size=1024x1024 \
  -F n=1 \
  -F quality=auto \
  -F output_format=png \
  -F "image=@/absolute/path/reference.png"

JavaScript:服務端請求

const response = await fetch("https://tokensclub.top/v1/responses", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TOKENSCLUB_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ model: "YOUR_ENABLED_MODEL", input: "只回覆 OK" })
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

串流與重試

需要串流時,按對應協議傳入 stream: true,並使用 SSE 解析器處理增量事件。斷線或超時後,先核對使用記錄;重試可能形成另一筆獨立用量。

圖片、工具調用、快取及長上下文的支援範圍取決於模型和渠道,不能由基本文字成功推斷。

更新:2026-10-25 · 內容以平台實際啟用功能為準