Skip to content

API 总览 ​

API Base URLhttps://codexapi.asia

所有公开模型接口都需要 API Key。推荐使用:

http
Authorization: Bearer YOUR_API_KEY

在线调试

打开交互式 API 调试台,可查看请求结构、切换端点并生成多种语言的调用代码。请只输入你自己的 API Key,调试台不会将认证信息写入文档内容。

端点列表 ​

方法路径用途
GET/v1/models查询当前 Key 可用模型
GET/v1/usage查询网关用量信息
POST/v1/responsesOpenAI Responses
GET/v1/responsesResponses WebSocket 升级入口
POST/v1/chat/completionsOpenAI Chat Completions
POST/v1/embeddingsOpenAI Embeddings
POST/v1/images/generations图像生成
POST/v1/images/edits图像编辑

OpenAI 接口 ​

Responses ​

bash
curl https://codexapi.asia/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "input": "Reply with OK.",
    "stream": false
  }'

Chat Completions ​

bash
curl https://codexapi.asia/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'

Embeddings ​

bash
curl https://codexapi.asia/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "input": "Text to embed"
  }'

请求 ID ​

排查错误时保留响应中的请求 ID 或响应头里的关联 ID。提供请求 ID、时间和模型即可,切勿发送完整 API Key。