OpenAI Custom 允许你配置任何 OpenAI 兼容的 API 服务。
OpenAI 官方:
Azure OpenAI:
| 字段 | 说明 |
|---|---|
| 名称 | 凭证标识名称 |
| API Key | OpenAI API Key |
| Base URL | API 端点(可选) |
不填写 Base URL 时,使用 OpenAI 官方端点:
https://api.openai.com/v1
| 服务 | Base URL |
|---|---|
| Azure OpenAI | https://{resource}.openai.azure.com/openai/deployments/{deployment} |
| Groq | https://api.groq.com/openai/v1 |
| Together AI | https://api.together.xyz/v1 |
| Ollama | http://localhost:11434/v1 |
providers:
- name: openai-official
type: openai-custom
api_key: "sk-..."
# 使用默认 Base URL
- name: azure-openai
type: openai-custom
api_key: "..."
base_url: "https://myresource.openai.azure.com/openai/deployments/gpt-4"
- name: ollama-local
type: openai-custom
api_key: "ollama" # Ollama 不需要真实 key
base_url: "http://localhost:11434/v1"
取决于你使用的服务,常见模型:
| 服务 | 模型 |
|---|---|
| OpenAI | gpt-4, gpt-4-turbo, gpt-3.5-turbo |
| Azure | 取决于部署 |
| Groq | llama-3.1-70b, mixtral-8x7b |
| Ollama | llama3, mistral, codellama |
添加自定义请求头:
openai-custom:
headers:
X-Custom-Header: "value"
Azure OpenAI 需要额外配置:
azure-openai:
api_key: "..."
base_url: "https://..."
api_version: "2024-02-15-preview"
headers:
api-key: "..." # Azure 使用 api-key 头