AiGoCode Docs

第一次请求

使用 OpenAI Compatible 接口完成一次聊天请求

下面用 OpenAI Compatible 的 chat/completions 接口完成一次最小请求。先把环境变量里的 AIGOCODE_API_KEY 换成你的真实密钥。

Terminal
export AIGOCODE_API_KEY="sk-your-api-key"

curl https://api.aigocode.com/v1/chat/completions \
  -H "Authorization: Bearer $AIGOCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.3-codex",
    "messages": [
      {
        "role": "user",
        "content": "Hello from AiGoCode"
      }
    ]
  }'

成功响应

成功后会返回 OpenAI Compatible 格式的响应,其中 choices[0].message.content 是模型回复内容。

response.json
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "gpt-5.3-codex",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! AiGoCode is ready."
      },
      "finish_reason": "stop"
    }
  ]
}

下一步

On this page