cloudflare / cloudflare/ai

How to use @google/genai with Vertex BYOK?

Open
#370 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
345
Avg merge
13h 31m
Merged PRs (30d)
1

Description

I've been trying to understand how to get @google/genai working with BYOK/Unified Billing gateways.

The following works for **unauthenticated** gateways, but defeats the purpose of centralizing secrets since they need to be passed at client creation.

```typescript
client = new GoogleGenAI({
vertexai: true,
project: googleCredentials.project_id,
location: 'global',
googleAuthOptions: {
credentials: {
client_email: googleCredentials.client_email,
private_key: googleCredentials.private_key,
},
},
httpOptions: {
baseUrl: `${CF_GATEWAY_BASE_URL({
accountId: c.env.CF_ACCOUNT_ID,
gatewayId: c.env.CF_AI_GATEWAY_UNAUTHED_ID,
})}/google-vertex-ai`,
},
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.