Meta Model API

Start here

Overview
Quickstart
Authentication
Models
SDKs and libraries
Pricing and rate limits

Capabilities

Tool calling
Tool search
Search grounding
Image understanding
Video understanding
File handling
Reasoning
Structured output
Prompt caching
Token counting

Protocols

Choosing an API
Responses API
Chat Completions API
Messages API

Cookbook

All recipes
API fundamentals
Agent patterns
Use cases
Building with Muse Code

Muse Code

Overview
Authentication and billing
Permissions and safety
Working with the agent
Configuration and context
Extending and automating

Muse Glimmer

Overview
Get the model
Prompting guide
Quantization
Speculative decoding
Run inference
Customization

Agent guides

Coding agents
Agent frameworks
Computer use

API reference

Introduction
Error handling
Status
Responses
Chat completions
Messages
Files
Models

Log in

--- meta: title: API fundamentals — Meta Model API cookbook description: Cookbook recipes for the Model API building blocks — chat completions, streaming, tool calling, structured output, caching, reasoning, vision, and search grounding. keywords: cookbook, API fundamentals, Muse Spark, chat completions, tool calling, structured output cms: layout: large in_page_nav: false alias: /model-api/docs/cookbook/api-fundamentals target: aidmc --- # API fundamentals Validate one building block at a time and walk away with a starter you can extend. Part of the [Cookbook](/docs/cookbook). <tile-group col="3"> <tile color="blue" icon="cube" href="/docs/cookbook/quickstart-chat-completions" title="Quickstart: chat completions"> Point the OpenAI SDK at a new base URL and make your first Muse Spark call.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/streaming-responses" title="Streaming responses"> Stream tokens as they generate and read usage in the final chunk.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/tool-function-calling" title="Tool and function calling"> Detect a tool call, execute it, and feed the result back into the loop.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/structured-output" title="Structured output"> Return JSON that matches your schema and parses on the first try.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/prompt-caching" title="Prompt caching"> Reuse a stable prompt prefix and measure cached tokens.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/reasoning-thinking-tokens" title="Reasoning and thinking tokens"> Set reasoning effort and replay reasoning across turns.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/vision-input" title="Vision input"> Send images by URL or base64 and get structured analysis back.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/long-context" title="Long context"> Pack repo-scale context into a single context window.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/error-handling-retry" title="Error handling and retry"> Back off with jitter and skip retries on client errors.</tile> <tile color="blue" icon="cube" href="/docs/cookbook/search-grounding" title="Search grounding"> Ground answers in live web search with inline citations.</tile> </tile-group>

API fundamentals

Validate one building block at a time and walk away with a starter you can extend. Part of the Cookbook.
Quickstart: chat completions Point the OpenAI SDK at a new base URL and make your first Muse Spark call.
Streaming responses Stream tokens as they generate and read usage in the final chunk.
Tool and function calling Detect a tool call, execute it, and feed the result back into the loop.
Structured output Return JSON that matches your schema and parses on the first try.
Prompt caching Reuse a stable prompt prefix and measure cached tokens.
Reasoning and thinking tokens Set reasoning effort and replay reasoning across turns.
Vision input Send images by URL or base64 and get structured analysis back.
Long context Pack repo-scale context into a single context window.
Error handling and retry Back off with jitter and skip retries on client errors.
Search grounding Ground answers in live web search with inline citations.
Was this page helpful?