API 总览
API Base URL
https://codexapi.asia所有公开模型接口都需要 API Key。推荐使用:
http
Authorization: Bearer YOUR_API_KEY在线调试
打开交互式 API 调试台,可查看请求结构、切换端点并生成多种语言的调用代码。请只输入你自己的 API Key,调试台不会将认证信息写入文档内容。
端点列表
| 方法 | 路径 | 用途 |
|---|---|---|
GET | /v1/models | 查询当前 Key 可用模型 |
GET | /v1/usage | 查询网关用量信息 |
POST | /v1/responses | OpenAI Responses |
GET | /v1/responses | Responses WebSocket 升级入口 |
POST | /v1/chat/completions | OpenAI Chat Completions |
POST | /v1/embeddings | OpenAI 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。
