Cookbook
Task-shaped recipes that combine Cruxy endpoints to do a real job: retrieval, tool loops, streaming, moderation, extraction, and evals.
The guides document each endpoint on its own: what POST /api/v1/rerank
returns, how stream changes the chat response. The cookbook is the other
half: recipes that wire endpoints together to finish a real job. Each one
runs end to end against https://api.cruxy.ai and reads from
CRUXY_API_KEY in the environment.
Embed a corpus, rank it by cosine, reorder the shortlist with rerank, then ground a chat answer in the winners.
Run the full round-trip: send tools, execute the calls the model returns, feed results back by id, loop until it stops.
Proxy the SSE stream past your key, render deltas without jank, and detect a stream that breaks after the 200.
Screen input with cruxy-guard before it reaches chat, and branch on flagged, never on the uncalibrated scores.
Pick a tier that supports structured output, send a JSON schema in response_format, and validate what comes back.
List a vault's files, download the text ones, rank their passages with embeddings and rerank, and ground a chat answer.
Build an eval suite per prompt version from the same cases, run both on one tier, and compare the pass counts.
What counts as a recipe
Every recipe here combines at least two endpoints, or solves a problem a single-endpoint guide cannot. Retrieval chains embeddings, rerank, and chat; the moderation gate puts one endpoint in front of another; the tool loop and the streaming UI each turn one endpoint into a working control flow the reference shape only hints at. When you need the exact fields instead, the guides, starting with Chat, document each endpoint once. The tool loop lives with the tool-calling pages in the Docs tab, next to Define tools and Handle tool calls.