Responses(Codex)
面向 Codex CLI 的 Responses 兼容接口。支持非流式 JSON,以及文本增量、函数调用参数增量和完成/失败事件。
POST
https://relayai.aolingtech.com/api/v1/responses请求格式#
json
{
"model": "deepseek-v4-flash",
"instructions": "You are a coding assistant.",
"input": "Explain this error in one sentence.",
"stream": true
}支持文本输入、对话消息、标准函数工具、Codex namespace 工具、Web Search、 Custom Tools、tool_search 以及对应的函数调用结果。Web Search 由 RelayAI 在服务端执行并将结果回填给上游模型。 当前不支持previous_response_id、服务端存储、WebSocket、Files 和 Images。未配置BRAVE_SEARCH_API_KEY时,Web Search 回落到 Bing Web Search。
Codex CLI 配置#
toml
model_provider = "relayai"
model = "deepseek-v4-flash"
[model_providers.relayai]
name = "RelayAI"
base_url = "https://relayai.aolingtech.com/api/v1"
wire_api = "responses"
requires_openai_auth = true
env_key = "RELAYAI_API_KEY"Codex 的 /responses 会由wire_api = "responses"自动拼接。base_url 必须停在/api/v1,不能包含/chat/completions 或/responses。
请求示例#
bash
curl "https://relayai.aolingtech.com/api/v1/responses" \
-H "Authorization: Bearer $RELAYAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"input": "Hello, RelayAI!",
"stream": false
}'将
RELAYAI_API_KEY 设为在控制台创建的 Key。请求指定模型时,请先为该 Key 授权。代码可左右滑动查看完整内容。