Skip to content

OpenAI 兼容 API

WebberAI 的 OpenAI 兼容入口适合绝大多数 SDK、Agent、ChatBot 和 IDE 插件。

API 端点

text
Base URL: https://webberai.top/v1
Models: /models
Chat Completions: /chat/completions
Responses: /responses

完整请求地址示例:

text
https://webberai.top/v1/chat/completions

认证方式

http
Authorization: Bearer YOUR_WEBBERAI_API_KEY

获取模型列表

bash
curl https://webberai.top/v1/models \
  -H "Authorization: Bearer YOUR_WEBBERAI_API_KEY"

Chat Completions

bash
curl https://webberai.top/v1/chat/completions \
  -H "Authorization: Bearer YOUR_WEBBERAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "从模型广场复制的模型 ID",
    "messages": [
      { "role": "user", "content": "请用一句话介绍 WebberAI。" }
    ]
  }'

流式响应

bash
curl https://webberai.top/v1/chat/completions \
  -H "Authorization: Bearer YOUR_WEBBERAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "从模型广场复制的模型 ID",
    "stream": true,
    "messages": [
      { "role": "user", "content": "输出三条使用建议。" }
    ]
  }'

Python SDK

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_WEBBERAI_API_KEY",
    base_url="https://webberai.top/v1",
)

response = client.chat.completions.create(
    model="从模型广场复制的模型 ID",
    messages=[
        {"role": "user", "content": "你好,WebberAI。"}
    ],
)

print(response.choices[0].message.content)

Responses API

如果你的客户端使用 Responses API,保持同一 Base URL:

bash
curl https://webberai.top/v1/responses \
  -H "Authorization: Bearer YOUR_WEBBERAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "从模型广场复制的模型 ID",
    "input": "写一个简短的产品说明。"
  }'

Images API

图像生成或多模态接口是否可用,取决于模型广场中的模型能力。使用前先确认模型支持图像能力。

错误处理

错误常见原因处理方式
401 / INVALID_API_KEYAPI Key 错误、过期或复制不完整重新创建并复制 API Key
404Base URL 错误或重复 /v1检查是否写成 /v1/v1
模型不存在模型 ID 错误或已下架从模型广场重新复制
余额不足账号余额不可用查看 Dashboard / Purchase / Redeem

WebberAI 文档仅用于产品使用说明,具体价格与可用模型以站内实时展示为准。