#1
阿里云百炼
国内直连 🟢 134ms 🎁 每日定时重置免费配额 (128k 上下文 · 每日自动重置)
阿里通义开源代码旗舰模型,在代码生成、补全、Debug与算法竞赛测试中比肩顶级闭源大模型,支持数十种编程语言。
按在线可用性与最低网络延迟智能排序,支持一键复制厂商专属 Model ID 并直达领 Key。
全量兼容 OpenAI SDK 规范,只需填入自己的 API Key 即可通过 Python 或 cURL 直接发起调用。
from openai import OpenAI
# 1. 替换为对应厂商领取的 API Key 与 Base URL (参见下方厂商雷达表)
client = OpenAI(
api_key="your_api_key_here",
base_url="https://api.siliconflow.cn/v1" # 示例: 硅基流动直连端点
)
response = client.chat.completions.create(
model="qwen2.5-coder-32b-instruct",
messages=[
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Hello! Please introduce yourself briefly."}
],
temperature=0.6,
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
curl https://api.siliconflow.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key_here" \
-d '{
"model": "qwen2.5-coder-32b-instruct",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7
}'