---
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.