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.

typescript
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:

NameTypeRequiredDescription
apiKeystringNoYour TypoMonster API key. Falls back to NEXT_PUBLIC_AI_PROXY_KEY env var.
proxyUrlstringNoProxy 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.

typescript
import { createProxyFetch } from "@ai-proxy/core";
 
const proxyFetch = createProxyFetch({
  proxyUrl: "https://chat-api.typo.monster",
  apiKey: "tmk_your_api_key_here",
});

Parameters:

NameTypeRequiredDescription
proxyUrlstringYesThe proxy endpoint URL.
apiKeystringYesYour TypoMonster API key (tmk_...).

Returns: A fetch-compatible function that rewrites requests to go through the proxy.

Usage with provider SDKs:

typescript
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 apiKey to "proxy-managed" when using createProxyFetch. The proxy handles authentication with the upstream provider.


API Keys

API keys are managed through the API Keys dashboard. Each key:

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:

bash
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.