API Reference
@ai-proxy/google
Drop-in replacement for @ai-sdk/google that routes requests through the TypoMonster proxy.
createProxyGoogle(config?)
Creates a proxy-aware Google Generative AI provider for the Vercel AI SDK.
import { createProxyGoogle } from "@ai-proxy/google";
const google = createProxyGoogle({
apiKey: "tmk_your_api_key_here",
proxyUrl: "https://chat-api.typo.monster", // optional, uses default
});
// Use like @ai-sdk/google
const model = google("gemini-2.5-flash");Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
apiKey | string | No | Your TypoMonster API key. Falls back to NEXT_PUBLIC_AI_PROXY_KEY env var. |
proxyUrl | string | No | Proxy endpoint URL. Falls back to NEXT_PUBLIC_AI_PROXY_URL, then https://chat-api.typo.monster. |
Returns: A Google AI provider function compatible with all Vercel AI SDK methods (generateText, streamText, generateObject, etc.).
@ai-proxy/core
Low-level proxy utilities for providers that aren't Google (OpenAI, Anthropic, etc.).
createProxyFetch(config)
Creates a proxy-aware fetch function. Pass it to any AI SDK that accepts a custom fetch option.
import { createProxyFetch } from "@ai-proxy/core";
const proxyFetch = createProxyFetch({
proxyUrl: "https://chat-api.typo.monster",
apiKey: "tmk_your_api_key_here",
});Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
proxyUrl | string | Yes | The proxy endpoint URL. |
apiKey | string | Yes | Your TypoMonster API key (tmk_...). |
Returns: A fetch-compatible function that rewrites requests to go through the proxy.
Usage with provider SDKs:
import { createOpenAI } from "@ai-sdk/openai";
import { createAnthropic } from "@ai-sdk/anthropic";
// OpenAI through the proxy
const openai = createOpenAI({
fetch: proxyFetch,
apiKey: "proxy-managed",
});
// Anthropic through the proxy
const anthropic = createAnthropic({
fetch: proxyFetch,
apiKey: "proxy-managed",
});Note: Set
apiKeyto"proxy-managed"when usingcreateProxyFetch. The proxy handles authentication with the upstream provider.
API Keys
API keys are managed through the API Keys dashboard. Each key:
- Starts with
tmk_prefix - Can be scoped to specific models
- Supports rate limiting (requests per minute)
- Has an optional expiration date
- Tracks usage automatically
Key Scoping
When creating a key, you can restrict it to specific models. A key scoped to gemini-2.5-flash will reject requests to any other model.
Leave "All models" enabled for unrestricted access.
Rate Limiting
Set a requests-per-minute (RPM) limit per key. Requests exceeding the limit receive a 429 Too Many Requests response.
REST API
You can also use the proxy directly via HTTP without any SDK:
curl -X POST \
'https://chat-api.typo.monster/proxy?url=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer tmk_your_api_key_here' \
-d '{
"contents": [{"role": "user", "parts": [{"text": "Hello!"}]}]
}'For streaming responses, use the streamGenerateContent?alt=sse endpoint instead of generateContent.