30 秒内完成第一次调用
先从 dashboard 拿到 API key,然后选择一种语言。QSP 相关的改动只有 base_url 和 key —— 其余完全是标准的 OpenAI SDK。
1. 获取 API key
登录 quicksilverpro.io/dashboard,在 "Connect your agent" 区域复制你的 key。
将其设为 QSP_KEY 环境变量,这样下面的代码片段就可以直接使用:
export QSP_KEY="sk-..."2. 发起调用
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.quicksilverpro.io/v1",
api_key=os.environ["QSP_KEY"],
)
resp = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Node.js / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.quicksilverpro.io/v1",
apiKey: process.env.QSP_KEY,
});
const resp = await client.chat.completions.create({
model: "deepseek-v4.1-flash",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);关闭思考:首个调用使用模型的默认设置即可返回可见答案。如需不带思考过程的直接回复,请将非标准 reasoning 字段放入 Python SDK 的 extra_body 参数。
resp = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hello!"}],
extra_body={"reasoning": {"enabled": False}},
)
print(resp.choices[0].message.content)TypeScript 请使用文档说明的 body 请求选项,作为 create 的第二个参数。它会替换请求体,因此需先展开标准 params,再添加 reasoning。参见 OpenAI Node SDK.
const params = {
model: "deepseek-v4.1-flash",
messages: [{ role: "user" as const, content: "Hello!" }],
};
const resp = await client.chat.completions.create(params, {
body: { ...params, reasoning: { enabled: false } },
});
console.log(resp.choices[0].message.content);Swift
import Foundation
import OpenAI
let openAI = OpenAI(
configuration: .init(
token: ProcessInfo.processInfo.environment["QSP_KEY"]!,
host: "api.quicksilverpro.io",
basePath: "/v1"
)
)
let query = ChatQuery(
messages: [.user(.init(content: .string("Hello!")))],
model: "deepseek-v4.1-flash"
)
let resp = try await openAI.chats(query: query)
print(resp.choices.first?.message.content?.string ?? "")curl
curl https://api.quicksilverpro.io/v1/chat/completions \
-H "Authorization: Bearer $QSP_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"messages": [{"role": "user", "content": "Hello!"}],
"reasoning": {"enabled": false}
}'3. 你会收到的响应
标准的 OpenAI chat-completions JSON。choices[0].message.content 是模型的回复。usage 字段汇报 prompt 与 completion token 数, 外加一个根据公开单价计算出的合成 cost 字段。
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1715800000,
"model": "deepseek-v4.1-flash",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hello! How can I help?"},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 8,
"total_tokens": 17,
"cost": 0.00000275
}
}下一步
- 为你的工作负载挑选合适的模型 — 模型。
- 按 token 流式接收输出 — Streaming。
- 拿到强类型的 JSON 响应 — Structured output。
语音
2. 导出密钥
export QSP_KEY="YOUR_API_KEY"3. 生成语音
curl https://api.quicksilverpro.io/v1/audio/speech \
-H "Authorization: Bearer $QSP_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"chatterbox-turbo","input":"Hello from QuickSilver Pro.","voice":"alloy"}' \
--output speech.mp3转录 speech.mp3(可选)
curl https://api.quicksilverpro.io/v1/audio/transcriptions \
-H "Authorization: Bearer $QSP_KEY" \
-F "model=qwen3-asr" \
-F "[email protected]" \
-F "response_format=json"打开 speech.mp3 收听音频。
模型、限制和设备说明
中文和英文转写推荐 qwen3-asr:3–8 秒音频实测耗时 0.3–0.7 秒(2026-10-12)。需要与 Whisper 保持一致时选择 whisper-large-v3-turbo;whisper-1 是它的兼容别名。
英文语音推荐 chatterbox-turbo:每百万字符 $1.50,一句话约 1 秒,是 OpenAI tts-1 标价($15)的十分之一。
中文或中英混合语音推荐 qwen3-tts:每百万字符 $25。这个价格高于 OpenAI tts-1 的 $15 标价;qwen3-tts 是能正确朗读中文的模型。
转写支持 file、model、language、prompt、temperature 和 timestamp_granularities[](word、segment)。合成支持 model、input、可选的 voice、response_format 和 speed(0.25–4)。
voice 为可选项。Chatterbox Turbo 原样传递任意声音字符串;Qwen3 TTS 忽略 voice。
Qwen3 TTS 目前只有一种声音。接受 OpenAI 声音名称,但会忽略。
兼容别名:whisper-1 → whisper-large-v3-turbo;tts-1 → qwen3-tts。tts-1 按 qwen3-tts 计费(每百万字符 $25)。chatterbox-turbo 每百万字符 $1.50,仅支持英语;需明确选择。计费与报表使用标准模型 ID。
整个 multipart 请求最多 25 MB、4 个部分、1 个非空音频文件,每部分文件头最多 8 KB。请求体须在 120 秒内上传完成;前 10 秒后,每个 10 秒窗口平均至少 16 KB/s。每个密钥最多同时上传 2 个请求;共享暂存限额超出时返回 429 和 Retry-After。
输入限制:4,000 个 Unicode 码点。拒绝空输入。每个码点计为一个字符,包括汉字和表情符号;组合附加符号和表情序列可能计为多个字符。
格式:json(默认)、text、verbose_json、srt、vtt。所有响应格式均按同一音频时长计费。
格式:mp3(默认)、wav、opus、flac、pcm。不支持 aac。音频随生成进度流式返回。
Chatterbox Turbo 仅支持英语;中文输入会产生无法理解的音频。
每次调用都会暂时预留费用,并按实际音频时长或字符数结算。
curl https://api.quicksilverpro.io/v1/audio/speech \
-H "Authorization: Bearer $QSP_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3-tts","input":"Hello from QuickSilver Pro.","voice":"alloy"}' \
--output speech.mp3设备和微控制器
API 主机使用 Let’s Encrypt TLS 证书链(ISRG Root X1 / X2)。固定使用其他提供商根证书的固件须改用 ISRG 根证书,或使用平台证书包。默认响应为 24 kHz 单声道 MP3。TTS 流式返回,请边下载边解码。输入最多 4,000 个字符;WAV 上传按精确时长预留费用。