GET /v1/models
列出此金鑰可使用的模型 ID。
curl "https://api.tokentpilot.com/v1/models" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY"可用模型及協定視乎帳戶權限與已啟用的渠道。請先查看模型清單及收費。
GET /v1/modelsPOST /v1/chat/completionsPOST /v1/responsesPOST /v1/messagesPOST /v1beta/models/{model}:generateContentPOST /v1/embeddingsPOST /v1/images/generationsPOST /v1/videosGET /v1/videos/{id}GET /v1/models列出此金鑰可使用的模型 ID。
curl "https://api.tokentpilot.com/v1/models" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY"POST /v1/chat/completions發起對話。將 stream 設為 true 並使用 curl -N 接收串流事件。
curl "https://api.tokentpilot.com/v1/chat/completions" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","messages":[{"role":"user","content":"Reply in one sentence."}]}'POST /v1/responses選擇支援 Responses 協定的模型,再使用 input 提交內容。
curl "https://api.tokentpilot.com/v1/responses" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","input":"Summarize this request in one sentence."}'POST /v1/messagesAnthropic Messages 格式,需提供 x-api-key 及協定版本。
curl "https://api.tokentpilot.com/v1/messages" \
-H "x-api-key: $TOKENPILOT_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","max_tokens":256,"messages":[{"role":"user","content":"Write a short greeting."}]}'POST /v1beta/models/{model}:generateContentGemini 原生請求,在 URL 路徑填上模型 ID。
curl "https://api.tokentpilot.com/v1beta/models/REPLACE_WITH_MODEL_ID:generateContent" \
-H "x-goog-api-key: $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Write a short greeting."}]}]}'POST /v1/embeddings使用嵌入模型將文字轉換成向量。
curl "https://api.tokentpilot.com/v1/embeddings" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","input":["API integration notes"]}'POST /v1/images/generations生成圖像。編輯請使用 POST /v1/images/edits,參數格式以所選模型為準。
curl "https://api.tokentpilot.com/v1/images/generations" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","prompt":"A ceramic cup on a wooden table in morning light."}'POST /v1/videos使用支援此協定的模型建立非同步影片工作,並儲存回應中的工作 ID。
curl "https://api.tokentpilot.com/v1/videos" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","prompt":"A slow camera pan across a quiet harbor."}'GET /v1/videos/{id}以適當間隔查詢工作狀態。工作完成後,如模型支援內容端點,便可下載結果。
curl "https://api.tokentpilot.com/v1/videos/REPLACE_WITH_JOB_ID" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY"
curl -L --output result.mp4 "https://api.tokentpilot.com/v1/videos/REPLACE_WITH_JOB_ID/content" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY"