API 文档
完全兼容 OpenAI 接口规范。将 Base URL 指向本站即可。
接入信息
Base URL
https://cai.yy-fun.cc/v1
鉴权
Authorization: Bearer sk-fai-你的密钥
在控制台 → API 密钥 中创建。
支持端点
GET /v1/models
POST /v1/chat/completions
POST /v1/images/generations
Chat Completions(流式)
curl https://cai.yy-fun.cc/v1/chat/completions \
-H "Authorization: Bearer sk-fai-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.5",
"stream": true,
"messages": [{"role":"user","content":"你好"}]
}'
Images Generations
curl https://cai.yy-fun.cc/v1/images/generations \
-H "Authorization: Bearer sk-fai-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "a futuristic city at dusk",
"size": "1024x1024"
}'
Python 示例
from openai import OpenAI
client = OpenAI(
api_key="sk-fai-xxx",
base_url="https://cai.yy-fun.cc/v1"
)
stream = client.chat.completions.create(
model="grok-4.5",
messages=[{"role":"user","content":"写一句问候"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")