Download wafer_AI/docs/serverless/router-setup.md from sangramrout/Chip_Design: direct link, hf CLI and curl.
- Browser
- Download file 4.41 kB
-
https://huggingface.co/datasets/sangramrout/Chip_Design/resolve/main/wafer_AI/docs/serverless/router-setup.md
- Command line
-
hf download hf://datasets/sangramrout/Chip_Design/wafer_AI/docs/serverless/router-setup.md
-
curl -L -o router-setup.md https://huggingface.co/datasets/sangramrout/Chip_Design/resolve/main/wafer_AI/docs/serverless/router-setup.md
Documentation Index
Fetch the complete documentation index at: https://docs.wafer.ai/llms.txt Use this file to discover all available pages before exploring further.
Router Setup
Use Wafer through Vercel AI Gateway, OpenRouter, and TrueFoundry AI Gateway.
Use these setup paths when your app already sends traffic through a model router or gateway. The router owns the API key, base URL, model slug, billing, and routing policy; Wafer serves the underlying model capacity.
For direct Wafer Serverless API usage, use API Reference. For coding agents and local harnesses, use Agent Setup.
Vercel
Wafer is available through Vercel AI Gateway for GLM 5.2 Fast.
Use the Vercel AI SDK model slug:
import { streamText } from "ai";
const result = streamText({
model: "zai/glm-5.2-fast",
prompt: "Why is the sky blue?",
});
See Vercel's GLM 5.2 Fast via Wafer changelog for provider-specific details.
OpenRouter
Wafer is listed as a provider on OpenRouter.
Use OpenRouter when you want Wafer models behind OpenRouter's unified API key, catalog, usage tracking, and routing controls.
OpenRouter model slugs are model-level slugs, not provider-specific slugs. To prefer GLM 5.2 Fast on Wafer, use z-ai/glm-5.2 and put the Wafer Fast provider endpoint first with provider.order: ["wafer/fast"].
curl -sS "https://openrouter.ai/api/v1/chat/completions" \
-H "Authorization: Bearer <YOUR_OPENROUTER_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "z-ai/glm-5.2",
"provider": {
"order": ["wafer/fast"]
},
"messages": [
{"role": "user", "content": "Reply with the single word: ready."}
]
}'
See OpenRouter's Quickstart for the API shape and Provider Routing for provider selection controls.
TrueFoundry
TrueFoundry AI Gateway is the proxy layer that sits between your applications and the LLM providers and MCP Servers. It is an enterprise-grade platform that enables users to access 1000+ LLMs using a unified interface while taking care of observability and governance.
Wafer is available natively in TrueFoundry AI Gateway. See TrueFoundry's Wafer provider docs for the source setup flow.
In TrueFoundry, go to **AI Gateway** → **Models**, select **Wafer**, and add your Wafer account.The default Wafer base URL is `https://pass.wafer.ai/v1`. Change it only if Wafer directs you to a different endpoint. Add your Wafer API key for authentication. Zero Data Retention is enabled by default; when enabled, TrueFoundry sends `Wafer-ZDR: required` on requests.
Add collaborators to the account if other users or teams should be able to access it.
Click **+ Add Models** and register the Wafer model IDs you want TrueFoundry to expose. For each model, set a display name, the exact Wafer model ID, and select **Chat** as the model type.
Common Wafer model IDs include `GLM-5.2`, `glm5.2-fast`, and `GLM-5.1`.
Use the TrueFoundry model ID format `your-wafer-account/model-display-name` through TrueFoundry's OpenAI-compatible `/chat/completions` API:
```python theme={null}
from openai import OpenAI
client = OpenAI(
api_key="your_truefoundry_api_key",
base_url="{GATEWAY_BASE_URL}",
)
response = client.chat.completions.create(
model="my-wafer-account/GLM-5.2",
messages=[{"role": "user", "content": "Hello, how are you?"}],
)
print(response.choices[0].message.content)
```