Connecting a custom model in the Vercel AI SDK normally means writing an OpenAI-compatible client wrapper, setting a base URL, and threading auth headers through your app config. For Kimi K3.1 Pro, wallaby-ai-provider skips that adapter code. Two lines do the wiring.
npm install wallaby-ai-provider ai
export WALLABY_API_KEY=sk-your-wallaby-key
import { generateText } from 'ai';
import { wallaby } from 'wallaby-ai-provider';
const { text, usage } = await generateText({
model: wallaby('kimi-k3.1-pro'),
prompt: 'Hello, world',
});
console.log(text);
console.log(usage);
wallaby-ai-provider wraps @ai-sdk/openai-compatible under the MIT license for Node.js 18 and newer, and npm serves 0.1.3 as the latest release as of November 28, 2026. Disclosure: Wallaby Token sells pay-as-you-go API access to Kimi models, and this package points to our endpoint.
Streaming and itemized usage
Swap generateText for streamText to print chunks as they arrive and read result.usage after the stream closes:
import { streamText } from 'ai';
import { wallaby } from 'wallaby-ai-provider';
const result = streamText({
model: wallaby('kimi-k3.1-pro'),
prompt: 'In three sentences: what does a 1M-token context window buy a coding agent?',
});
for await (const delta of result.textStream) {
process.stdout.write(delta);
}
// Wait for the stream to finish, then inspect token counts
const usage = await result.usage;
console.log(usage);
Every completed call returns token counts in usage, matching the itemized request log in the Wallaby console.
Two live runs and the exact bill
On November 18, 2026, we ran both scripts above against our live gateway with wallaby-ai-provider 0.1.2, ai 7.0.176, and kimi-k3.1-pro. Each call was billed at Kimi K3.1 Pro's standing rates of $1.80 per 1M input tokens and $9.00 per 1M output tokens. That run applies only to wallaby-ai-provider 0.1.2 paired with ai 7.0.176; we have not run a separate test pass on wallaby-ai-provider 0.1.3 or ai releases newer than 7.0.176 for this revision. New accounts start with $0.50 in trial credit, which at $0.0043 per streaming call ($0.50 ÷ $0.0043) covers about 116 runs of that size.
| Call | Model | Input tokens | Output tokens | Rate-card math | Billed |
|---|---|---|---|---|---|
generateText |
kimi-k3.1-pro |
24 | 64 | (24 × $1.80 + 64 × $9.00) ÷ 1,000,000 = $0.0006192 |
$0.0006 |
streamText |
kimi-k3.1-pro |
103 | 456 | (103 × $1.80 + 456 × $9.00) ÷ 1,000,000 = $0.0042894 |
$0.0043 |
Using the provider in Next.js
Drop the same wallaby import into an App Router handler at app/api/chat/route.ts:
import { streamText } from 'ai';
import { wallaby } from 'wallaby-ai-provider';
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: wallaby('kimi-k3.1-pro'),
messages,
});
return result.toUIMessageStreamResponse();
}
Put WALLABY_API_KEY=sk-your-wallaby-key in .env.local instead of exporting it in a shell. Next.js loads .env.local into process.env on the server, so the key stays inside the route handler and never ships to the browser. Our November 18 verification covered the standalone Node generateText and streamText scripts on wallaby-ai-provider 0.1.2 and ai 7.0.176, without a separate Next.js, agent, or structured-output test suite for this revision.
Models, limits, and standing rates
All three Kimi models on Wallaby share a 1,048,576-token context window, a 131,072-token max output ceiling, and text plus image input support; kimi-k3.1-pro and kimi-k3.1-pro-highspeed also accept low, high, and max reasoning efforts. Per 1M tokens from pricing.json, last verified November 5, 2026 and read November 28, 2026:
| Model ID | Wallaby input | Wallaby cached | Wallaby output | Official list: in / cached / out | Standing discount |
|---|---|---|---|---|---|
kimi-k3.1-pro |
$1.80 | $0.18 | $9.00 | $2.00 / $0.20 / $10.00 | 10% off list |
kimi-k3.1-pro-highspeed |
$3.60 | $0.18 | $18.00 | $4.00 / $0.20 / $20.00 | 10% off list |
kimi-k3 |
$2.55 | $0.255 | $12.75 | $3.00 / $0.30 / $15.00 | 15% off list |
These are standing pay-as-you-go rates with no subscription and no promo deadline. Check the pricing page for current rates, or read Kimi K3.1 Pro on Wallaby for cross-tool setup notes.
Who Wallaby is for
Wallaby is built for TypeScript and Next.js developers already standardized on the Vercel AI SDK who want Kimi K3.1 Pro behind one npm package instead of maintaining a custom provider adapter. It fits teams and solo developers who prefer prepaid, per-token billing with itemized usage over fixed monthly seats. One WALLABY_API_KEY gives access to kimi-k3.1-pro, kimi-k3.1-pro-highspeed, and kimi-k3 by swapping the model ID in wallaby(...).
Fixing two common first-run errors
401 Unauthorized on the first call. WALLABY_API_KEY is not visible to the running process. In a terminal script, confirm export WALLABY_API_KEY=... ran in the same shell window; in Next.js, put the key in .env.local and restart next dev.
"model not found" from the API. The provider passes your model string straight through to the endpoint. Use an exact catalog ID like kimi-k3.1-pro, kimi-k3.1-pro-highspeed, or kimi-k3, or the matching moonshotai/ alias such as moonshotai/kimi-k3.1-pro, rather than a display name or a guessed variant like kimi-k3-turbo.
Next steps
Create a Wallaby Token account and mint your API key, then run npm install wallaby-ai-provider ai, set WALLABY_API_KEY, and log result.usage on your first generateText or streamText call.
- Comparing access routes: Where to get Kimi K3: every access route compared
- Using a terminal agent instead of TypeScript: Kimi K3 CLI setup: every terminal and coding tool that works, in one table
Every request lands on your invoice as an itemized line with token counts — no content logs, no training on your data, no usage reports built from your traffic. We host open-weight models only, keep a public status page, and run our own work through the same gateway we sell.