适合读者- 会写 OpenAI SDK 的 Python/Node/Java/Go 开发者- 想快速试国产模型但不想学新 SDK- 需要国内支付方式的开发者#### 目录1. 注册与获取 Key2. Python 多模型调用示例3. 流式输出SSE配置4. Function Calling 实战5. 多模态调用图片理解6. 常用模型推荐与价格参考#### 1. 注册与获取 Ke打开 → 注册 → 邮箱验证 → Dashboard 创建 API Key。**注意Key 只显示一次请立即保存**#### 2. Python 多模型调用pythonfrom openai import OpenAIclient OpenAI(api_key你的APIKey,base_urlhttps://apihub4u.com/v1)# 4 种模型一键切换 # 通用对话 — DeepSeekprint(client.chat.completions.create(modeldeepseek-chat,messages[{role: user, content: 介绍一下Python装饰器}]).choices[0].message.content)# 高速低价 — 通义 Turboprint(client.chat.completions.create(modelqwen-turbo,messages[{role: user, content: 写一首关于夏天的诗}]).choices[0].message.content)# 永久免费 — GLM-4-Flashprint(client.chat.completions.create(modelglm-4-flash,messages[{role: user, content: 今天的日期是什么}]).choices[0].message.content)# 推理编程 — DeepSeek Reasonerprint(client.chat.completions.create(modeldeepseek-reasoner,messages[{role: user, content: 用Python写一个快速排序}]).choices[0].message.content)#### 3. 流式输出pythonstream client.chat.completions.create(modeldeepseek-chat,messages[{role: user, content: 讲个故事}],streamTrue)for chunk in stream:if chunk.choices[0].delta.content:print(chunk.choices[0].delta.content, end, flushTrue)#### 4. Function Callingpythontools [{type: function,function: {name: get_weather,description: 获取指定城市的天气,parameters: {type: object,properties: {city: {type: string, description: 城市名称}},required: [city]}}}]response client.chat.completions.create(modelqwen-plus,messages[{role: user, content: 北京今天天气怎么样}],toolstools,tool_choiceauto)print(response.choices[0].message.tool_calls)#### 5. 图片理解Visionpythonresponse client.chat.completions.create(modelqwen-vl-plus,messages[{role: user,content: [{type: text, text: 这张图片里有什么},{type: image_url, image_url: {url: https://example.com/photo.jpg}}]}])#### 6. 模型推荐与价格| 场景 | 推荐模型 | 价格每百万 Token ||------|---------|-------------------|| 日常对话 | glm-4-flash | **免费** || 高速对话 | qwen-turbo | $0.10 || 长文处理 | qwen-long | $0.2810M 上下文 || 代码生成 | qwen-coder-plus | $1.19 || 深度推理 | deepseek-reasoner | $0.33 || 最强对话 | qwen3-max | $1.42 || 图片理解 | qwen-vl-plus | $0.32 |#### 总结API Hub 让国产模型的接入成本降到和 OpenAI 一样低——你唯一需要做的就是从注册到第一个 API 调用这 5 分钟。有问题评论区留言看到就回。### 配图建议1. 每个代码块的运行结果截图2. Dashboard 操作流程 GIF3. 模型选择器截图