跳到正文
沉思波CHENSIBO
← 知识库
KB / 01接入API

天枢网关快速接入

用一个 OpenAI 兼容客户端,五分钟完成第一次请求。

准备

  1. 在天枢后台创建 API Key;
  2. 确认要使用的模型名;
  3. 记下接口地址:https://gateway.chensibo.cn/v1。

发一次请求

curl https://gateway.chensibo.cn/v1/chat/completions \
  -H "Authorization: Bearer $TIANSHU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "你好"}]
  }'

常见问题

  • 401:Key 不对、已吊销,或没有带 Bearer 前缀。
  • 404:base_url 少了 /v1,或路径拼错。
  • 模型不存在:以天枢后台的模型清单为准。

更完整的参数与错误码见 天枢 API 文档。