第 1 步:取得您的 API 金鑰
新增點數
打開儀表板並為您的帳戶新增點數。LemonData 採用隨用隨付 (pay-as-you-go) 的計費方式,無最低承諾。
建立 API 金鑰
前往 儀表板 → API 金鑰 並建立新的金鑰。請妥善複製並安全保存,因為金鑰只會顯示一次。
請妥善保管您的 API 金鑰。切勿在客戶端程式碼或公開的儲存庫中暴露它。
第 2 步:安裝客戶端
第 3 步:送出您的第一個請求
對於大多數新的整合,請從 Chat Completions(聊天補全) 與 POST /v1/chat/completions 開始。
curl https://api.lemondata.cc/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [
{"role": "user", "content": "What is the capital of France?"}
]
}'
只有在明確需要 Responses(回應) 特定行為時才使用 POST /v1/responses。某些僅限 Responses(回應) 的欄位依賴於所選模型與路由路徑。
嘗試不同的模型
LemonData 支援超過 300 個模型。只需變更 model 欄位:
response = client.chat.completions.create( model = "gpt-5.4" , messages = [{ "role" : "user" , "content" : "Hello" }])
response = client.chat.completions.create( model = "gpt-5-mini" , messages = [{ "role" : "user" , "content" : "Hello" }])
response = client.chat.completions.create( model = "claude-sonnet-4-6" , messages = [{ "role" : "user" , "content" : "Hello" }])
response = client.chat.completions.create( model = "gemini-2.5-flash" , messages = [{ "role" : "user" , "content" : "Hello" }])
response = client.chat.completions.create( model = "deepseek-r1" , messages = [{ "role" : "user" , "content" : "Hello" }])
啟用串流
stream = client.chat.completions.create(
model = "gpt-5.4" ,
messages = [{ "role" : "user" , "content" : "Tell me a short story." }],
stream = True
)
for chunk in stream:
delta = chunk.choices[ 0 ].delta.content
if delta:
print (delta, end = "" )
接下來要做什麼?
OpenAI SDK 使用官方的 OpenAI SDK 搭配 LemonData。