The NexToken Cookbook

Copy-paste recipes for shipping production LLM apps. Every example runs against the live NexToken API with nex-pro as the default — Singapore-hosted, $0.10/1M input, 32K context.

📖 API docs ⚡ Install CLI
★ Featured recipes
5 MIN · LIVE

Migrating from OpenAI in 2 lines

Switch your existing OpenAI SDK code to NexToken by changing only api_key and base_url. Save ~95%.

nex-pro · Python / Node / curl
15 MIN · LIVE

Chinese-strong RAG customer support

End-to-end retrieval-augmented Q&A in Chinese using nex-embed-zh + nex-pro. Pgvector + chunking.

nex-embed-zh · nex-pro · pgvector
10 MIN · LIVE

Multilingual translation pipeline

EN ↔ ZH ↔ JA ↔ KO translation with quality scoring. Streaming + tool calling for term-glossary injection.

nex-pro · streaming · tools
12 MIN · LIVE

Cost-optimised batch classification

Classify 100K rows of support tickets at 30% off retail via the batch endpoint. Includes resume + retry.

nex-pro · /v1/batches · 30% discount
⏳ Coming soon
DRAFT

Automated PR code review with nex-pro

GitHub Actions workflow that runs nex-pro on every PR diff, comments inline. ~$0.02 per medium PR.

nex-pro · GitHub Actions
DRAFT

Long-document contract review

Chunk + summarise + risk-flag long contracts using nex-reasoning. Map-reduce pattern with citations.

nex-reasoning · 128K · map-reduce
DRAFT

Real-time streaming with the nex CLI

Build a terminal chat UX that streams tokens. Hook stdin pipes to nex chat --stream.

nex CLI · SSE · pipes
DRAFT

Per-key budget & cost monitoring

Set spend caps per app, alert via Slack on 80%/100%, query MTD by provider. Production cost-control patterns.

model_allowlist · budget_cap · Slack