Cookbook

Task-shaped recipes that combine Cruxy endpoints to do a real job: retrieval, a tool-calling loop, a streaming UI, and a moderation gate.

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.

Retrieval-augmented generation

Embed a corpus, rank it by cosine, reorder the shortlist with rerank, then ground a chat answer in the winners.

Tutorial: build a tool-using agent

Run the full round-trip: send tools, execute the calls the model returns, feed results back by id, loop until it stops.

Streaming chat in the browser

Proxy the SSE stream past your key, render deltas without jank, and detect a stream that breaks after the 200.

Moderation gate

Screen input with cruxy-guard before it reaches chat, and branch on flagged, never on the uncalibrated scores.

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.

Was this page helpful?