cURL 示例

使用 cURL 直接从终端测试 API。将你的 API 密钥设置为环境变量以方便使用:

cURL
export PANDA_API_KEY="sk-your-key-here"

聊天补全

cURL
curl https://api.pandaworld.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PANDA_API_KEY" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

流式响应 (SSE)

cURL
curl https://api.pandaworld.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PANDA_API_KEY" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Count to 10."}],
    "stream": true
  }'

列出模型

cURL
curl https://api.pandaworld.space/v1/models \
  -H "Authorization: Bearer $PANDA_API_KEY" | jq .

查询余额

cURL
curl https://api.pandaworld.space/v1/dashboard/billing \
  -H "Authorization: Bearer $PANDA_API_KEY" | jq .

一行命令快速测试

cURL
curl -s https://api.pandaworld.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PANDA_API_KEY" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Say hello"}]}' \
  | jq -r '.choices[0].message.content'