TypeScript
Python
Chat Completions
较旧的库可能仍会调用 Chat Completions:注意事项
- 使用 Phaseo 模型 ID,包括
openai/、anthropic/或google/等提供商前缀。 - 服务器工具使用 Phaseo 工具名称,例如
phaseo:web_search。 - 对于 Anthropic 原生客户端,请改用 Anthropic SDK 指南。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
将 OpenAI 官方 SDK 与 Phaseo 搭配使用。
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PHASEO_API_KEY,
baseURL: "https://api.phaseo.app/v1",
});
const response = await client.responses.create({
model: "openai/gpt-5-nano",
input: "Write one sentence about reliable model routing.",
});
console.log(response.output_text);
pip install openai
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PHASEO_API_KEY"],
base_url="https://api.phaseo.app/v1",
)
response = client.responses.create(
model="openai/gpt-5-nano",
input="Write one sentence about reliable model routing.",
)
print(response.output_text)
const completion = await client.chat.completions.create({
model: "openai/gpt-5-nano",
messages: [{ role: "user", content: "Reply with only: ok" }],
});
openai/、anthropic/ 或 google/ 等提供商前缀。phaseo:web_search。