Google Vertex AI ↗ 使开发者能够轻松构建和部署企业级生成式 AI 体验。
以下是设置您的 Google Cloud 账户的快速指南:
-
Google Cloud Platform (GCP) 账户
- 注册 GCP 账户 ↗。新用户可能有资格获得积分(有效期 90 天)。
-
启用 Vertex AI API
- 导航到启用 Vertex AI API ↗ 并为您的项目激活 API。
-
申请访问所需模型。
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 将使用上述数据的结构: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 "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" } ] }'
- @2025 Cloudflare Ubitools
- Cf Repo