Pythonfrom openai import OpenAI
client = OpenAI(
base_url="https://openllmapi.com/v1",
api_key="你的API Key"
)
response = client.chat.completions.create(
model="ads-fast", # 或 code-fast, web-fast, opus-local
messages=[{"role": "user", "content": "你好"}]
)
print(response.choices[0].message.content)
cURLcurl https://openllmapi.com/v1/chat/completions \
-H "Authorization: Bearer 你的API Key" \
-H "Content-Type: application/json" \
-d '{
"model": "ads-fast",
"messages": [{"role": "user", "content": "你好"}]
}'
JavaScriptconst response = await fetch("https://openllmapi.com/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer 你的API Key",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "ads-fast",
messages: [{ role: "user", content: "你好" }]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);