客户端接入
把客户端的接口地址指到本站,密钥填令牌。不要填其他中转地址。
基址二选一,看客户端是否会自己补上 /v1:
| 客户端的要求 | 填写 |
|---|---|
| 需要 OpenAI 的 base URL,会把路径接到这个地址后面 | https://uni.sointech.com.cn/v1 |
只填站点根地址,自己请求 /v1/chat/completions | https://uni.sointech.com.cn |
密钥始终是控制台创建的 sk-...,不要带 Bearer 前缀;Bearer 只出现在 HTTP 头里。
OpenAI Python SDK
python
from openai import OpenAI
client = OpenAI(
api_key="sk-你的令牌",
base_url="https://uni.sointech.com.cn/v1",
)
response = client.chat.completions.create(
model="qwen-plus",
messages=[{"role": "user", "content": "你好"}],
)
print(response.choices[0].message.content)openai 包使用 pip install openai 安装。base_url 要保留末尾的 /v1。
OpenAI Node SDK
javascript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-你的令牌",
baseURL: "https://uni.sointech.com.cn/v1",
});
const response = await client.chat.completions.create({
model: "qwen-plus",
messages: [{ role: "user", content: "你好" }],
});
console.log(response.choices[0].message.content);Claude SDK
Claude 官方 SDK、Claude Code 使用另一条地址,不要填 OpenAI 的 /v1。根地址是 https://uni.sointech.com.cn,请求路径由 SDK 补成 /v1/messages。字段和示例见 Claude 兼容接口。
python
import anthropic
client = anthropic.Anthropic(
api_key="sk-你的令牌",
base_url="https://uni.sointech.com.cn",
)兼容客户端
选择 OpenAI 兼容或自定义接口,然后:
- 接口地址按上一张表填写,不要重复追加
/v1。 - API Key 填令牌。
- 模型名填 模型列表 里的
id,不要沿用客户端预置的、本站没有的模型名。
Cherry Studio 一类桌面客户端,提供商选 OpenAI 兼容,接口地址填 https://uni.sointech.com.cn,密钥填令牌。如果请求变成 /v1/v1/chat/completions,说明地址里多写了一次 /v1,删掉即可。
