securityauth

创建 API Key

Odyssey API 使用 API Key 进行身份验证。您可以在控制台的“API 设置”页面中查看和管理您的 API Key。

安全提示

您的 API Key 具有极高的权限,请务必妥善保管。切勿在客户端代码或公共仓库(如 GitHub)中泄露。

使用方式

发起请求时,请在 Authorization 请求头中使用 Bearer Token 形式传递密钥。

如果你只是先验证连通性,建议从一条最小 curl 请求开始。

# 使用 cURL 发送对话请求
curl https://api.odysseyapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ODYSSEY_API_KEY" \
  -d '{
    "model": "gpt-5.4",
    "messages": [{"role": "user", "content": "hello"}]
  }'
# 响应示例
{
  "id": "resp_08cb12451a5beb170169f82c76af3081918cc012557014d8e4",
  "object": "chat.completion",
  "created": 1777871991,
  "model": "gpt-5.4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 13,
    "total_tokens": 31
  }
}