Skip to content
Cloudflare Docs
非官方翻译 - 此文档为非官方中文翻译版本,仅供参考。如有疑问请以 英文官方文档 为准。

Google Vertex AI

Google Vertex AI 使开发者能够轻松构建和部署企业级生成式 AI 体验。

以下是设置您的 Google Cloud 账户的快速指南:

  1. Google Cloud Platform (GCP) 账户

    • 注册 GCP 账户。新用户可能有资格获得积分(有效期 90 天)。
  2. 启用 Vertex AI API

  3. 申请访问所需模型。

端点

https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-vertex-ai

前提条件

在向 Google Vertex 发出请求时,您需要:

  • AI 网关账户标签
  • AI 网关网关名称
  • Google Vertex API 密钥
  • Google Vertex 项目名称
  • Google Vertex 区域(例如,us-east4)
  • Google Vertex 模型

URL 结构

您的新基础 URL 将使用上述数据的结构:https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-vertex-ai/v1/projects/{project_name}/locations/{region}

然后您可以附加您要访问的端点,例如:/publishers/google/models/{model}:{generative_ai_rest_resource}

因此您的最终 URL 将组合为:https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-vertex-ai/v1/projects/{project_name}/locations/{region}/publishers/google/models/gemini-1.0-pro-001:generateContent

示例

cURL

示例获取请求
curl "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-vertex-ai/v1/projects/{project_name}/locations/{region}/publishers/google/models/gemini-1.0-pro-001:generateContent" \
-H "Authorization: Bearer {vertex_api_key}" \
-H 'Content-Type: application/json' \
-d '{
"contents": {
"role": "user",
"parts": [
{
"text": "Tell me more about Cloudflare"
}
]
}'