调用模型

适用场景

开发者在业务系统中使用 API Key 调用模型。

前提条件

  • 已获得 API Key。
  • API Key 已授权目标模型。
  • 目标模型存在可用渠道。

Chat Completions 示例

curl http://{ROUTER_HOST}:3080/v1/chat/completions \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "请生成一段巡检摘要"
      }
    ],
    "stream": false
  }'

Responses 示例

curl http://{ROUTER_HOST}:3080/v1/responses \
  -H "Authorization: Bearer {API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": "总结今天的 API 网关状态"
  }'

验证方式

  • 响应中返回模型输出。
  • 用量日志 中出现本次请求。
  • 如为流式请求,客户端能持续接收增量输出。