BYOKSBYOKS Docs

快速开始

BYOKS 让你用自己的 API Key 访问所有主流 AI 模型,通过统一的 OpenAI 兼容接口。

三步接入

1. 获取 API Key

byoks.com 注册并创建 API Key。

2. 配置环境

export OPENAI_BASE_URL=https://api.byoks.com/v1
export OPENAI_API_KEY=your-byoks-key

3. 开始使用

你现有的 OpenAI 兼容代码无需修改即可运行。

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.byoks.com/v1',
  apiKey: 'your-byoks-key',
});

const response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: '你好!' }],
});

console.log(response.choices[0].message.content);
from openai import OpenAI

client = OpenAI(
    base_url="https://api.byoks.com/v1",
    api_key="your-byoks-key",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "你好!"}],
)

print(response.choices[0].message.content)
curl https://api.byoks.com/v1/chat/completions \
  -H "Authorization: Bearer your-byoks-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "你好!"}]
  }'

为什么选择 BYOKS

特性说明
自带 Key使用你自己的 Provider Key,费用直接计入你的账户
统一接口所有模型通过 OpenAI 格式调用,无需学习不同 SDK
智能路由自动故障转移、成本优化、延迟优化
边缘加速全球边缘节点,就近转发请求

下一步