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。
