使用 API Key 访问 Google Cloud Vertex AI 服务,支持模型别名映射。
Vertex AI Provider 允许你:
credential_pool:
vertex_api_keys:
- id: "vertex-main"
api_key: "vk-123..."
base_url: "https://example.com/api"
disabled: false
credential_pool:
vertex_api_keys:
- id: "vertex-main"
api_key: "vk-123..."
base_url: "https://example.com/api"
proxy_url: "socks5://proxy:1080"
models:
- name: "gemini-2.0-flash"
alias: "vertex-flash"
- name: "gemini-1.5-pro"
alias: "vertex-pro"
disabled: false
| 配置项 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | ✅ | 凭证唯一标识 |
| api_key | string | ✅ | Vertex AI API Key |
| base_url | string | ❌ | Vertex AI 端点 URL |
| proxy_url | string | ❌ | 单独的代理 URL |
| models | array | ❌ | 模型别名映射列表 |
| disabled | boolean | ❌ | 是否禁用此凭证 |
模型别名允许你使用自定义名称访问上游模型:
vertex-flash)gemini-2.0-flash)models:
- name: "gemini-2.0-flash" # 上游模型名
alias: "vertex-flash" # 客户端使用的别名
- name: "gemini-1.5-pro"
alias: "vertex-pro"
- name: "gemini-2.0-flash-lite"
alias: "vertex-lite"
Vertex AI Provider 使用 x-goog-api-key 头进行认证:
x-goog-api-key: your-api-key
ProxyCast 会自动将配置的 API Key 添加到请求头中。
credential_pool:
vertex_api_keys:
- id: "vertex-1"
api_key: "vk-123..."
base_url: "https://endpoint1.example.com/api"
- id: "vertex-2"
api_key: "vk-456..."
base_url: "https://endpoint2.example.com/api"
curl http://127.0.0.1:8999/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.0-flash",
"messages": [{"role": "user", "content": "Hello!"}]
}'
curl http://127.0.0.1:8999/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "vertex-flash",
"messages": [{"role": "user", "content": "Hello!"}]
}'
将 Vertex 模型路由到 Vertex AI Provider:
routing:
rules:
- pattern: "vertex-*"
provider: "vertex"
priority: 1
| 特性 | Vertex AI | Gemini API Key |
|---|---|---|
| 认证方式 | x-goog-api-key | API Key |
| 模型别名 | ✅ | ❌ |
| 模型排除 | ❌ | ✅ |
| 自定义 Base URL | ✅ | ✅ |
| 适用场景 | Vertex 兼容端点 | 官方 Gemini API |