> ## Documentation Index
> Fetch the complete documentation index at: https://runinfra.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cookbook

> Copy-paste recipes for common RunInfra inference patterns. Recipes require a key and a deployment that supports the selected route.

Every recipe below is a minimal example for a supported deployment. Copy it, swap in your key and the model ID returned by `GET /v1/models`, then run it. No framework setup, no extra deps unless noted.

<Columns cols={2}>
  <Card title="Streaming responses" icon="zap" href="/cookbook/streaming">
    Token-by-token SSE with the OpenAI SDK. Python, TS, curl.
  </Card>

  <Card title="Tool calling" icon="wrench" href="/cookbook/tool-calling">
    Function calling with typed args and multi-turn tool loops.
  </Card>

  <Card title="Structured output" icon="braces" href="/cookbook/structured-output">
    JSON Schema validation, guaranteed parseable responses.
  </Card>

  <Card title="Retrieval-augmented generation" icon="database" href="/cookbook/rag">
    Embed, retrieve, generate. End-to-end RAG in under 30 lines.
  </Card>
</Columns>

## What this section is for

Reach for the cookbook when you want to **ship a specific pattern fast**. The conceptual guides under Features explain *why* something works. Cookbook recipes show *how* with the shortest code path.

## What to install once

```bash theme={"dark"}
pip install openai
npm i openai
```

Most recipes use the OpenAI SDK because it is the familiar path for OpenAI-shaped endpoints. Use the native [RunInfra SDK](/tools-sdks/runinfra-sdk) when you want pipeline IDs, typed errors, request IDs, replay-safe idempotency helpers, deployment-gated audio/image helpers, or webhook signature verification in one client.

## Recipe template

Every page follows the same shape so you can skim fast:

1. **What this does**, one sentence.
2. **When to use it**, two lines explaining the trigger.
3. **Minimal code**, copy-paste, runs as-is.
4. **What to tune**, a short table of knobs and their effect.
5. **Common mistakes**, three to five gotchas.
6. **Next steps**, adjacent recipes.

## Contribute a recipe

Open a PR on [`RightNow-AI/runinfra-docs`](https://github.com/RightNow-AI/runinfra-docs) with a new `cookbook/<name>.mdx`. Keep code under 40 lines, prose under 200 words.
