POST https://vertex-gateway.3171711374.workers.dev/v1/chat/completions — 对话(支持 stream: true)POST https://vertex-gateway.3171711374.workers.dev/v1/completions — 文本补全(旧版接口)POST https://vertex-gateway.3171711374.workers.dev/v1/embeddings — 文本向量GET https://vertex-gateway.3171711374.workers.dev/v1/models — 模型列表GET https://vertex-gateway.3171711374.workers.dev/health — 健康检查(无需鉴权)POST https://vertex-gateway.3171711374.workers.dev/v1/vertex/generate — Vertex 原生透传curl https://vertex-gateway.3171711374.workers.dev/v1/chat/completions \
-H "Authorization: Bearer $PROXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash",
"messages": [{"role":"user","content":"你好,用一句话介绍你自己"}]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://vertex-gateway.3171711374.workers.dev/v1",
api_key="你的 PROXY_API_KEY",
)
resp = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)
默认区域 global。可在模型名后加 @区域,或使用请求头 x-vertex-location 覆盖,例如:
"model": "gemini-2.5-pro@europe-west1"