一个密钥,所有模型。
通过统一 API,把账户可用的模型接入自己的应用。在兼容的 OpenAI 客户端中配置 API request URL 和密钥,从实时目录选择模型 ID,再用小请求验证。密钥应保存在服务端,实际用量、权限与限额请在账户中核对。
https://aifiesta-api.dev.codexcape.solutions/v1Authorization: Bearer af_YOUR_API_KEY每个密钥每分钟 60 次请求快速开始
从下方 curl 或 OpenAI SDK 示例开始,替换地址、密钥和模型 ID。确认返回内容正确后,再按需要加入流式输出、超时和错误处理。
curl https://aifiesta-api.dev.codexcape.solutions/v1/chat/completions \
-H "Authorization: Bearer af_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "Say hello in five words."}]
}'from openai import OpenAI
client = OpenAI(base_url="https://aifiesta-api.dev.codexcape.solutions/v1", api_key="af_YOUR_API_KEY")
resp = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{"role": "user", "content": "Say hello in five words."}],
stream=True,
)
for chunk in resp:
print(chunk.choices[0].delta.content or "", end="")import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://aifiesta-api.dev.codexcape.solutions/v1", apiKey: "af_YOUR_API_KEY" });
const res = await client.chat.completions.create({
model: "claude-sonnet-5",
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(res.choices[0].message.content);
console.log(res.aifiesta); // { points_charged, points_balance, upstream_model }返回内容
标准的 OpenAI chat.completion 对象,外加一个 aifiesta 字段,包含本次调用扣除的积分和你的剩余余额。设置 stream: true 时会收到 chat.completion.chunk 帧,并以 data: [DONE] 结束。
图片以 image_url 内容块发送(支持 https 或 data URL)。照常设置 max_tokens 和 temperature;各厂商的差异由我们处理。
端点
所有路径相对于基础 URL,且都需要你的密钥。
/models实时目录返回你可用的所有模型,包括 type(chat / image / video)、points_per_request 和上下文窗口。
/chat/completionsOpenAI 对话结构。请求体:model、messages,可选 stream、max_tokens、temperature。费用:该模型的积分,仅在成功时扣除。
/images/generations同步接口。请求体:model、prompt,可选 n(1–4)、aspect_ratio(如 16:9)或 OpenAI 的 size,可选 image_url 作为编辑参考。返回托管的 URL。失败的图片会退还积分。
curl https://aifiesta-api.dev.codexcape.solutions/v1/images/generations \
-H "Authorization: Bearer af_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-flash-image", "prompt": "a paper boat on a puddle after rain", "aspect_ratio": "16:9"}'/videos/generations异步返回 202 和任务 ID;每隔几秒轮询 GET /videos/generations/{id},直到 status 为 completed(此时 url 已就位)或 failed(积分退还)。请求体:model、prompt、aspect_ratio、duration 秒数,可选 image_url 首帧。
curl https://aifiesta-api.dev.codexcape.solutions/v1/videos/generations \
-H "Authorization: Bearer af_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "veo-3-1", "prompt": "slow dolly through a misty pine forest at dawn", "aspect_ratio": "16:9", "duration": 6}'
# then
curl https://aifiesta-api.dev.codexcape.solutions/v1/videos/generations/JOB_ID -H "Authorization: Bearer af_YOUR_API_KEY"/usage该密钥的请求数与积分消耗、当前余额以及最近的调用。
错误与限制
401 invalid_api_key— 密钥缺失、错误或已撤销。402 insufficient_points— 请充值或兑换码后重试。403 model_not_allowed/api_key_disabled/api_access_disabled— 管理员限制了该模型、密钥或账户;请联系支持。404 not_found— 未知的model;请查看GET /models。429 rate_limited— 每个密钥每分钟 60 次请求;请等待details.retry_after秒后重试。429 quota_exceeded— 已达到管理员为你的账户设置的每日请求或每月积分上限;GET /usage的quota字段显示限额。502 provider_error/503 model_unavailable— 经过重试和回退后上游仍有问题;未扣除任何费用。
错误响应体与 OpenAI 一致:{"error": {"message", "type", "code"}}。
需要 API 尚未覆盖的功能?从账户页联系支持。

