Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-create-google-alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ai-gateway-provider": patch
---

Add `createGoogle` as an alias for `createGoogleGenerativeAI` in the Google provider. This fixes the mismatch between the Cloudflare dashboard example (which uses `createGoogle()`) and the package export. Both names now work interchangeably.
20 changes: 20 additions & 0 deletions packages/ai-gateway-provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@ const aigateway = createAiGateway({
- `retryDelayMs`: Delay between retries
- `backoff`: Retry backoff strategy ('constant', 'linear', 'exponential')

### Google AI Studio Example

```typescript
import { createAiGateway } from "ai-gateway-provider";
import { createGoogle } from "ai-gateway-provider/providers/google";
import { generateText } from "ai";

const aigateway = createAiGateway({
accountId: "{CLOUDFLARE_ACCOUNT_ID}",
gateway: "{GATEWAY_NAME}",
});

const google = createGoogle({ apiKey: "{GOOGLE_API_KEY}" });

const { text } = await generateText({
model: aigateway(google("gemini-1.5-pro")),
prompt: "Write a vegetarian lasagna recipe for 4 people.",
});
```

## Supported Providers

- OpenAI
Expand Down
2 changes: 2 additions & 0 deletions packages/ai-gateway-provider/src/providers/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ import { authWrapper } from "../auth";
export const createGoogleGenerativeAI = (
...args: Parameters<typeof createGoogleGenerativeAIOriginal>
) => authWrapper(createGoogleGenerativeAIOriginal)(...args);

export const createGoogle = createGoogleGenerativeAI;
2 changes: 1 addition & 1 deletion packages/ai-gateway-provider/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export { createDeepgram } from "./deepgram";
export { createDeepSeek } from "./deepseek";
export { createElevenLabs } from "./elevenlabs";
export { createFireworks } from "./fireworks";
export { createGoogleGenerativeAI } from "./google";
export { createGoogle, createGoogleGenerativeAI } from "./google";
export { createVertex } from "./google-vertex";
export { createGroq } from "./groq";
export { createMistral } from "./mistral";
Expand Down