主题
cURL 调用示例
基础对话
bash
curl https://api.echoly.cn/v1/chat/completions \
-H "Authorization: Bearer sk-你的Key" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.6",
"messages": [
{ "role": "user", "content": "用一句话解释什么是递归" }
]
}'流式输出
bash
curl https://api.echoly.cn/v1/chat/completions \
-H "Authorization: Bearer sk-你的Key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{ "role": "system", "content": "你是一个 Python 编程专家" },
{ "role": "user", "content": "写一个冒泡排序" }
],
"stream": true
}'多轮对话
bash
curl https://api.echoly.cn/v1/chat/completions \
-H "Authorization: Bearer sk-你的Key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{ "role": "user", "content": "1+1等于几?" },
{ "role": "assistant", "content": "1+1等于2。" },
{ "role": "user", "content": "那再加上3呢?" }
]
}'图片生成
bash
curl https://api.echoly.cn/v1/images/generations \
-H "Authorization: Bearer sk-你的Key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "一只穿着太空服的柴犬,数字绘画风格",
"n": 1,
"size": "1024x1024"
}'使用 Claude 协议
bash
curl https://api.echoly.cn/v1/messages \
-H "x-api-key: sk-你的Key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"max_tokens": 1024,
"messages": [
{ "role": "user", "content": "你好" }
]
}'使用 Gemini 协议
bash
curl "https://api.echoly.cn/v1beta/models/gpt-5.6-terra:generateContent?key=sk-你的Key" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "parts": [{ "text": "你好" }] }
]
}'常用参数
| 参数 | 说明 | 示例 |
|---|---|---|
model | 模型名 | "kimi-k2.6" |
messages | 对话消息数组 | [{"role":"user","content":"hi"}] |
stream | 流式输出 | true / false |
temperature | 随机性 0~2 | 0.7 |
max_tokens | 最大输出长度 | 4096 |
top_p | 核采样 | 1.0 |
