Skip to main content
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.

Streaming responses

Token-by-token SSE with the OpenAI SDK. Python, TS, curl.

Tool calling

Function calling with typed args and multi-turn tool loops.

Structured output

JSON Schema validation, guaranteed parseable responses.

Retrieval-augmented generation

Embed, retrieve, generate. End-to-end RAG in under 30 lines.

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

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 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 with a new cookbook/<name>.mdx. Keep code under 40 lines, prose under 200 words.