Files
nexus/wiki/concepts/多Provider图像生成.md
2026-05-03 05:42:12 +08:00

52 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "多Provider图像生成"
type: concept
tags: []
sources: [baoyu-skills]
last_updated: 2026-04-19
---
## Overview
多 Provider 图像生成是 [[baoyu-imagine]] 技能的核心架构——通过统一接口封装多个图像生成服务商,实现 provider 自动选择和环境变量配置管理,用户无需关心底层服务商细节。
## Supported Providers
| Provider | API | 模型 | 特色 |
| --- | --- | --- | --- |
| OpenAI | `OPENAI_API_KEY` | gpt-image-1.5 | 主流,质量稳定 |
| Google | `GOOGLE_API_KEY` | gemini-3-pro-image-preview | 高质量 |
| Azure OpenAI | `AZURE_OPENAI_API_KEY` | 可配置部署名 | 企业级 |
| OpenRouter | `OPENROUTER_API_KEY` | google/gemini-3.1-flash-image-preview | 统一网关 |
| DashScope阿里通义万相 | `DASHSCOPE_API_KEY` | qwen-image-2.0-pro | 中文优化,支持 21:9 |
| Z.AI | `ZAI_API_KEY` | glm-image | 海报/图表,中英文 |
| MiniMax | `MINIMAX_API_KEY` | image-01 | 低延迟,支持参考图 |
| 即梦Jimeng | 火山引擎 Key | jimeng_t2i_v40 | 国内直达 |
| 豆包Seedream | ARK API Key | doubao-seedream-5-0-260128 | 参考图能力强 |
| Replicate | `REPLICATE_API_TOKEN` | google/nano-banana-2 | nano-banana 系列 |
## Auto-Selection Logic
1. 显式指定 `--provider` → 使用指定的
2. 传入 `--ref` 参考图且未指定 provider → 依次尝试 Google、OpenAI、Azure、OpenRouter、Replicate、Seedream、MiniMax
3. 只有一个 API 密钥 → 使用对应服务商
4. 多个可用 → 默认优先级Google > OpenAI > Azure > OpenRouter > DashScope > Z.AI > MiniMax > Replicate > 即梦 > 豆包
## Configuration Hierarchy
环境变量通过四层加载(高优先级覆盖低优先级):
1. 命令行环境变量
2. `process.env`(系统环境变量)
3. `~/.baoyu-skills/.env`(用户级)
4. `<cwd>/.baoyu-skills/.env`(项目级)
## Key Design Decisions
- `--model` 参数在 Azure 表示 deployment name不是底层模型家族名
- 参考图能力因 provider 而异Google/OpenAI/Azure/OpenRouter/Replicate/MiniMax/Seedream 5.0/4.5/4.0 支持;即梦不支持
- Replicate 只保存单张输出图,`--n > 1` 会本地报错避免结果静默丢弃
## Connections
- [[baoyu-imagine]] ← implements ← 多Provider图像生成
- [[baoyu-skills]] ← 包含 ← 多Provider图像生成