Google Vertex
The @typochat-sdk/google-vertex package is a drop-in replacement for @ai-sdk/google-vertex.
It routes Gemini requests through the TypoMonster proxy using Vertex AI Express Mode, so your app uses a TypoMonster API key instead of Google Cloud credentials.
Use @typochat-sdk/google for Google AI Studio. Use @typochat-sdk/google-vertex when you want the Vertex provider path.
Installation
npm install @typochat-sdk/google-vertex aiSetup
import { createProxyVertex } from "@typochat-sdk/google-vertex";
const vertex = createProxyVertex({
apiKey: "tmk_your_api_key_here", // express mode
});You can also configure via environment variables instead of passing them directly:
| Variable | Description |
|---|---|
NEXT_PUBLIC_AI_PROXY_KEY | Your TypoMonster API key (tmk_...) |
NEXT_PUBLIC_AI_PROXY_URL | Proxy URL (defaults to https://chat-api.typo.monster) |
// When env vars are set, no config needed
const vertex = createProxyVertex();Context Keys
Pass a contextKey to group related requests and improve cache hit rates:
const vertex = createProxyVertex({
apiKey: "tmk_your_api_key_here", // express mode
contextKey: "chat-session-abc123",
});Available Models
Google Vertex uses the same Gemini model list as the Google provider:
| Model | Description |
|---|---|
gemini-3.1-pro-preview | Most capable preview model |
gemini-3.1-flash-lite-preview | Lightweight Gemini 3.1 preview model |
gemini-3-flash-preview | Gemini 3 flash preview model |
gemini-2.5-pro | Capable model for complex tasks |
gemini-2.5-flash | Fast and efficient, great balance of speed and quality |
gemini-2.5-flash-lite | Lightweight model for simple tasks |
Text Generation
import { createProxyVertex } from "@typochat-sdk/google-vertex";
import { generateText } from "ai";
const vertex = createProxyVertex({
apiKey: "tmk_your_api_key_here", // express mode
});
const { text } = await generateText({
model: vertex("gemini-3.1-flash-lite-preview"),
prompt: "What is the capital of France?",
});
console.log(text);Streaming
import { createProxyVertex } from "@typochat-sdk/google-vertex";
import { streamText } from "ai";
const vertex = createProxyVertex({
apiKey: "tmk_your_api_key_here", // express mode
});
const result = streamText({
model: vertex("gemini-3.1-flash-lite-preview"),
prompt: "Write a short story about a robot.",
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}Reasoning (Thinking)
Vertex uses vertex provider options:
import { createProxyVertex } from "@typochat-sdk/google-vertex";
import { generateText } from "ai";
const vertex = createProxyVertex({
apiKey: "tmk_your_api_key_here", // express mode
});
const { text, reasoning } = await generateText({
model: vertex("gemini-2.5-flash"),
prompt: "How many r's are in the word strawberry?",
providerOptions: {
vertex: {
thinkingConfig: { includeThoughts: true },
},
},
});
console.log("Answer:", text);
console.log("Reasoning:", reasoning);To disable thinking for supported models:
providerOptions: {
vertex: {
thinkingConfig: { thinkingBudget: 0 },
},
}Migrating from @ai-sdk/google-vertex
The migration is a small provider setup change:
- import { createVertex } from "@ai-sdk/google-vertex/edge";
+ import { createProxyVertex } from "@typochat-sdk/google-vertex";
- const vertex = createVertex({
- project: "YOUR_GOOGLE_CLOUD_PROJECT",
- location: "global",
- });
+ const vertex = createProxyVertex({
+ apiKey: "tmk_your_api_key_here", // express mode
+ });
// Everything below stays exactly the same
const { text } = await generateText({
model: vertex("gemini-3.1-flash-lite-preview"),
prompt: "Hello!",
});Direct HTTP
You can call Vertex through the proxy without an SDK:
curl -X POST \
'https://chat-api.typo.monster/proxy?url=https://aiplatform.googleapis.com/v1/publishers/google/models/gemini-3.1-flash-lite-preview:generateContent' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer tmk_your_api_key_here' \
-d '{
"contents": [{"role": "user", "parts": [{"text": "Hello!"}]}]
}'The proxy rewrites the Express Mode URL to the configured Vertex project and location before forwarding upstream.
Next Steps
- Getting Started — overview and quick start
- Google Gemini — Google AI Studio provider
- API Reference — proxy SDK configuration
- Try it live in the Playground