快速開始
From signing in to a working integration. Each step takes a minute or two, and you can stop after step 3 if all you need is one call.
What you are about to do - Get a key, prove it works without writing code, wire it into your app, then keep it topped up. Where a welcome campaign is running you can do the first calls on free credit; otherwise a small top-up comes first.
1. 取得你的 API Key
登入並前往 Console → API Keys. 點擊 "建立金鑰" 並立即複製——它只會顯示一次。
2. 發出你的第一個請求
選擇你已經在用的 SDK。兩種範例都使用同一個 API key 存取同一個 gateway。
方案 A —— OpenAI SDK
curl https://synthorai.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-5.4-mini",
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
]
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://synthorai.io/v1"
)
response = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Hello! What can you do?"}]
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://synthorai.io/v1",
});
const response = await client.chat.completions.create({
model: "gpt-5.4-mini",
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(response.choices[0].message.content);方案 B —— Anthropic SDK
curl https://synthorai.io/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
]
}'from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_API_KEY",
base_url="https://synthorai.io"
)
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=256,
messages=[{"role": "user", "content": "Hello! What can you do?"}]
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "YOUR_API_KEY",
baseURL: "https://synthorai.io",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 256,
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(message.content[0].text);Anthropic SDK 會在內部追加 /v1/messages 。請使用 gateway origin(不帶 /v1 後綴)作為 base_url ——這與接受 https://synthorai.io/v1.
3. Try it without writing code
Open the Playground in the console, pick a model and send a prompt. It runs through the same pipeline as your API traffic, so a reply confirms the model and your balance. It authenticates with your console session rather than an API key, so test the key itself with the request above.
4. 列出可用模型
curl https://synthorai.io/v1/models \
-H "Authorization: Bearer YOUR_API_KEY" 模型 ID 遵循原始供應商使用的格式。你可以透過以下方式取得完整清單: /v1/models 端點,或造訪 模型目錄 頁面。
5. Wire it into your app
Point your existing client at the gateway: change the base URL and use your Synthorai key. Your model ids, request shapes and SDKs stay as they are. From there the capability guides cover the things that change your bill - caching a repeated prefix, or capping how much a model thinks.
Using Claude Code, Codex CLI or OpenClaw instead of an SDK? Those have their own one-line setup:
6. Add credit when you need it
Usage draws down a prepaid balance - no monthly platform fee, no subscription. Top up from Billing with a card or crypto; the balance is usable the moment it lands. Free credit comes from a welcome campaign where one is running, not automatically on signup.
Where to go next
- Prompt caching - bill a repeated prefix at a fraction of its normal price
- Reasoning effort - the biggest cost lever on models that reason by default
- API keys - quotas, model allowlists, expiry and rotation
- Usage analytics - where the spend actually went
驗證
所有 API 請求都需要在以下位置傳入 API 金鑰: Authorization 請求標頭中傳入。
Bearer Token
Authorization: Bearer YOUR_API_KEY 金鑰權限範圍
| 參數 | 類型 | 說明 |
|---|---|---|
Read | string | 僅可存取模型清單與用量資料。 |
Write | string | 發起推理請求(chat、completions)。 |
Admin | string | 完整存取權限,包括通道與使用者管理。 |
切勿在用戶端程式碼或公開儲存庫中暴露你的 API 金鑰。若金鑰外洩,請立即透過以下位置輪換: Console → API 金鑰.
金鑰格式
Synthorai 金鑰以以下前綴開頭: sk- 後接一個隨機的 32 字元字串。金鑰在儲存時經過雜湊處理,建立後無法復原。
不確定從哪個模型開始?瀏覽 model price comparison 即可並排查看每個可路由模型的按 token 價格。