AURA-1 chip design archive: docs, blog, research folders, tiny-gpu work, GDS viewer
7858a76 verified |
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
4.41 kB
| > ## 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](/serverless/api-reference). For coding agents and local harnesses, use [Agent Setup](/serverless/setup). | |
| ## Vercel | |
| Wafer is available through [Vercel AI Gateway](https://vercel.com/ai-gateway/models/glm-5.2-fast) for `GLM 5.2 Fast`. | |
| Use the Vercel AI SDK model slug: | |
| ```ts theme={null} | |
| 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](https://vercel.com/changelog/glm-5-2-fast-via-wafer-now-available-on-ai-gateway) for provider-specific details. | |
| ## OpenRouter | |
| Wafer is listed as a provider on [OpenRouter](https://openrouter.ai/provider/wafer). | |
| 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`](https://openrouter.ai/z-ai/glm-5.2) and put the Wafer Fast provider endpoint first with `provider.order: ["wafer/fast"]`. | |
| <Warning> | |
| Use the full endpoint slug `wafer/fast`. The base slug `wafer` matches all Wafer endpoints for this model, including the standard Wafer endpoint. Fallbacks remain enabled, so OpenRouter can route to another available endpoint if Wafer Fast is unavailable. | |
| </Warning> | |
| ```bash theme={null} | |
| 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](https://openrouter.ai/docs/quickstart) for the API shape and [Provider Routing](https://openrouter.ai/docs/features/provider-routing) for provider selection controls. | |
| ## TrueFoundry | |
| [TrueFoundry AI Gateway](https://www.truefoundry.com/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](https://www.truefoundry.com/docs/ai-gateway/wafer#wafer) for the source setup flow. | |
| <Steps> | |
| <Step title="Add a Wafer account"> | |
| 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. | |
| </Step> | |
| <Step title="Register models"> | |
| 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`. | |
| </Step> | |
| <Step title="Call the gateway"> | |
| 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) | |
| ``` | |
| </Step> | |
| </Steps> | |