28 recipes, three sections: a field guide to the Model API cookbook
Meta’s cookbook promises recipes that run the first time you copy them. The promise holds because of how it’s structured — each section assumes exactly what the previous one proved.
The design philosophy
Every recipe is a self-contained, copy-paste starting point that proves one capability and leaves you something to build on. Setup is deliberately trivial: a Model API account, a key exported as MODEL_API_KEY, and the OpenAI SDK pointed at https://api.meta.ai/v1. The API is drop-in compatible with the OpenAI SDK, the Anthropic SDK, and agent CLIs like OpenCode — so the recipes run against tools you already have. Formats: Colab notebooks plus standalone Python files.
Section one: API fundamentals (10 recipes)
The primitives, one at a time: your first chat completion, streaming, tool calling, structured output, prompt caching, reasoning-token control, vision input, long context, error handling with backoff, and search grounding with inline citations. The discipline here is validating one building block per recipe — when something breaks later in a complex agent, you’ll know which primitive to suspect because you’ve seen each one work in isolation.
Two are easy to underrate. Prompt caching is the economics of agentic coding — repository context re-sent every turn bills at the cached rate, a fraction of fresh input (the tier math covers why that dominates real bills). And structured output — schema-guaranteed JSON that parses on the first try — is the difference between an agent pipeline and a pile of regex.
Section two: agent patterns (5 recipes)
This is where a model becomes an agent: the core perceive-decide-act loop, interleaved reasoning and tool use in a single turn, context management across long runs, validated in-place edits (search-and-replace that checks itself — the pattern every serious coding agent uses), and an alert-fatigue copilot that extracts grounded patterns from a noisy feed with strict-JSON self-assessment. Five recipes, and collectively they’re a working blueprint of how tools like Muse Code are constructed inside.
Section three: use cases (13 recipes)
The payoff section, and the range is the point: chart analysis and screenshot-to-bugfix on the perception side; browser-verified web design and game dev, where the agent checks its own work in a real browser; sandboxed code execution; a four-profile product studio (PM, backend, frontend, tech writer) coordinating through a shared Kanban board; a one-shot 3D game built from a single structured prompt; an autonomous GitHub Actions bot; and computer use on both Linux and macOS. Each one is a small production pattern, not a toy.
Where to start
If you’re evaluating the API: fundamentals 01 (quickstart), then 03 (tool calling), then agent patterns 01 — an afternoon, and you’ll understand the platform’s shape. If you’re a Muse Code user, go straight to the three Muse Code recipes — agent fan-out, bundled skills, goal tracking — which turn the product’s core patterns into runnable code. The full index lists all 28 with links to the source.