Curl 调用示例
2026/3/22小于 1 分钟
使用前说明
如果你已经在控制台 API 密钥 -> 使用密钥 中拿到了更具体的 Base URL 或客户端配置,请优先以控制台为准。本文示例主要用于快速手动联调。
提示
所有示例中的 {此处填写API Key} 都替换成你在 https://rust.cat 后台创建的 API Key。
OpenAI / Codex 兼容
responses 接口
curl https://rust.cat/codex/v1/responses \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写API Key}' \
-d '{
"model": "gpt-5.2",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "你好"
}
]
}
],
"stream": true
}'相关信息
鉴权请求头兼容 Authorization 和 x-api-key,可任选其一。
chat/completions 接口
curl https://rust.cat/codex/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {此处填写API Key}' \
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream": true
}'Claude
curl https://rust.cat/claude/v1/messages \
-H 'Content-Type: application/json' \
-H 'x-api-key: {此处填写API Key}' \
-d '{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好",
"cache_control": { "type": "ephemeral" }
}
]
}
],
"max_tokens": 32000,
"stream": true
}'相关信息
鉴权请求头兼容 Authorization 和 x-api-key,可任选其一。
