Configuration method (choose one of three, by priority)
Method 1: Configuration file (recommended)
Create file ~/.jiekou/config.json:
{
"api_key": "你的API_Key"
}
Complete configuration with one command:
mkdir -p ~/.jiekou && echo '{"api_key": "你的API_Key"}' > ~/.jiekou/config.json
Method 2: Environment variables
export JIEKOU_API_KEY="你的API_Key"
Method 3: Direct parameter passing
Provide directly in the request:请用 API Key sk_xxx 生成一张图片...
API Key reading logic
1. 检查用户消息中是否包含 API Key(sk_ 开头)
2. 检查配置文件 ~/.jiekou/config.json
3. 检查环境变量 JIEKOU_API_KEY
4. 都没有 → 返回配置引导
Configuration guide message (only displayed when not configured):
您还没有配置接口AI的 API Key。
快速配置(复制运行):
mkdir -p ~/.jiekou && echo '{"api_key": "你的Key"}' > ~/.jiekou/config.json
获取 Key:https://jiekou.ai/settings/key-management
Execution flow (important!)
用户请求 → 识别任务 → 获取 Key → ⚠️ 先发提示 → 执行任务 → 返回结果
⚠️ A progress prompt must be sent first
Before calling the API, you must first reply to the user with a message:
🎨 收到!正在为您生成图片...
任务类型:文生图
使用模型:Gemini 3.1 Flash Image
预计耗时:10-30秒
预计费用:约 $0.03 元
请稍等,生成完成后会立即发送给您 ⏳
This message must be sent before executing the API call! This way the user knows the task has started processing and will not think the system is stuck.
Prompt templates for different tasks
Text-to-image:
🎨 收到!正在为您生成图片...
使用模型:Gemini 3.1 Flash Image
预计耗时:10-30秒
Text-to-video:
🎬 收到!正在为您生成视频...
使用模型:Veo 3.1
预计耗时:1-3分钟(视频生成较慢,请耐心等待)
TTS:
🔊 收到!正在为您生成语音...
使用模型:MiniMax Speech 2.6
预计耗时:5-10秒
Reply after completion
✅ 生成完成!
[图片/视频/音频 URL]
实际消耗:$0.03 元
Polling prompt for video tasks
Video generation requires polling, updating the status every 15 seconds:
🎬 视频生成中...
当前状态:处理中
已等待:30 秒
预计还需:1-2 分钟
API configuration
| Configuration item | Value |
|---|---|
| Base URL | https://api.jiekou.ai |
| Authentication | Authorization: Bearer <API_KEY> |
| Get Key | https://jiekou.ai/settings/key-management |
Task types and endpoints
| Task | Endpoint | Default model | Fast model |
|---|---|---|---|
| Text-to-image | /v3/gemini-3.1-flash-image-text-to-image |
Gemini 3.1 Flash | Seedream 5.0 Lite |
| Image editing | /v3/gemini-3.1-flash-image-edit |
Gemini 3.1 Flash | - |
| Text-to-video | /v3/async/veo-3.1-generate-text2video |
Veo 3.1 | Hailuo 2.3 |
| Image-to-video | /v3/async/veo-3.1-generate-img2video |
Veo 3.1 | Hailuo 2.3 |
| TTS | /v3/minimax-speech-2.6-turbo |
MiniMax Speech 2.6 | - |
| Task query | /v3/async/task-result?task_id=xxx |
- | - |
Fast model trigger words: Use the fast model when the user says "hurry up", "speed up", or "urgent"
Execution templates
Text-to-image
curl -X POST "https://api.jiekou.ai/v3/gemini-3.1-flash-image-text-to-image" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "描述", "size": "1K", "aspect_ratio": "1:1"}'
Fast mode:
curl -X POST "https://api.jiekou.ai/v3/seedream-5.0-lite" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "描述"}'
Image editing
curl -X POST "https://api.jiekou.ai/v3/gemini-3.1-flash-image-edit" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "编辑指令", "reference_images": ["图片URL"]}'
Text-to-video
curl -X POST "https://api.jiekou.ai/v3/async/veo-3.1-generate-text2video" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "描述", "duration_seconds": 4}'
Fast mode:
curl -X POST "https://api.jiekou.ai/v3/async/minimax-hailuo-2.3-t2v" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "描述", "duration": 6}'
Image-to-video
curl -X POST "https://api.jiekou.ai/v3/async/veo-3.1-generate-img2video" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "动作描述", "image": "图片URL"}'
TTS
curl -X POST "https://api.jiekou.ai/v3/minimax-speech-2.6-turbo" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "要转换的文字",
"voice_setting": {"voice_id": "male-qn-qingse", "speed": 1.0},
"audio_setting": {"format": "mp3"}
}'
Available voices:
- Male voice:
male-qn-qingse(youthful),male-qn-jingying(elite) - Female voice:
female-shaonv(young girl),female-yujie(mature woman)
Task result query
curl "https://api.jiekou.ai/v3/async/task-result?task_id=$TASK_ID" \
-H "Authorization: Bearer $API_KEY"
Status: TASK_STATUS_QUEUED → TASK_STATUS_PROCESSING → TASK_STATUS_SUCCEED
Error handling
| Error code | Meaning | Handling |
|---|---|---|
| 401 | Invalid Key | Check configuration |
| 402 | Insufficient balance | https://jiekou.ai/billing Top up |
| 429 | Requests too frequent | Wait and retry |