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.