Cookbook

Production recipes for the Gateway API

Copy, paste, and ship. Recipes cover prompting systems, agent workflows, multimodal pipelines, and eval guardrails.

Chat completions

Structured prompts with deterministic output and usage totals.

Streaming chat

SSE streaming with chunk-by-chunk updates.

Audio transcription

Upload WAV or stream PCM over WebSocket.

Text to speech

Generate audio with voice, emotion, and speed controls.

Avatar streaming

Synchronized audio + blendshape frames over WebSocket.

Fine-tuning jobs

Create and manage model fine-tuning pipelines.

Prompting systems

System prompts, output contracts, and prompt tests.

Agent workflows

Tool routing, handoffs, and memory patterns.

Guardrails + evals

Policy checks, regression suites, and eval flywheels.

Prompting system starter kit

Build system + developer prompts with contracts, tool gating, and JSON outputs.

You are the Disruptive Rain Ops Analyst.
Mission: deliver an executive brief under 200 words.
Rules:
- Use plain language with no internal policy references.
- If data is missing, say "unknown" and propose the next best action.
Return JSON with keys: summary, risks, next_steps.
System promptsOutput schemasPrompt tests
Prompting checklist
  • Pin the role, audience, and mission in the system prompt.
  • Declare non-negotiables such as safety, compliance, or confidentiality.
  • Provide an output schema and example to eliminate ambiguity.
  • Add tool usage rules and required data sources.
  • Include a verification step before final output.
Prompt patterns

Prompt contract

Define output fields, ordering, and token limits.

Few-shot anchor

Include one high-quality example for format alignment.

Tool gating

Specify when to call search, retrieval, or tools.

Critique pass

Validate the draft against requirements before finalizing.

Memory scoping

Reference only approved context windows and metadata.

Fallback plan

Provide safe defaults and next steps when data is missing.

Explore prompting guides
Gateway recipes

Core gateway recipes

End-to-end request and streaming examples for the most common gateway workloads.

Chat completion recipe

Standard request with full JSON response.

curl https://<gateway-host>/v1/chat/completions \
  -H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {"text": "Summarize the top three risks from the report."},
    "stream": false
  }'
Streaming chat recipe

Receive SSE chunks for low-latency UI updates.

curl -N https://<gateway-host>/v1/chat/completions \
  -H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {"text": "Stream this response."},
    "stream": true
  }'
Audio transcription

Upload WAV or stream PCM frames over WebSocket.

curl https://<gateway-host>/v1/audio/transcriptions \
  -H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
  -F file=@sample.wav
Text-to-speech

Generate speech with voice, emotion, and speed controls.

curl https://<gateway-host>/v1/audio/speech \
  -H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"text":"Welcome aboard","voiceId":"default","emotion":"neutral"}'
Avatar streaming

Receive synchronized audio and blendshape frames.

const ws = new WebSocket('wss://<gateway-host>/v1/avatar/stream');

ws.onopen = () => {
  ws.send(JSON.stringify({
    text: 'Hello from the avatar stream',
    sessionId: 'avatar_123',
    voiceId: 'default',
    emotion: 'neutral',
    speed: 1.0,
  }));
};

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
  if (message.type === 'audio') console.log(message.audio);
  if (message.type === 'blendshape') console.log(message.frameIndex);
};
Fine-tuning jobs

Create a fine-tuning job and monitor progress.

curl https://<gateway-host>/v1/fine-tuning/jobs \
  -H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "modelId": "sidis-1",
    "trainingData": {"type": "file", "id": "file_123"},
    "hyperparameters": {"epochs": 3, "batchSize": 8}
  }'
Agent workflows

Agentic playbooks for production

Reference architectures for tool routing, memory, multimodal streams, and eval loops.

Support triage agent

Routes inbound tickets, calls retrieval for account context, and escalates with a crisp summary.

RoutingRAGHandoff
Tool-using research agent

Chains search, file analysis, and summarization into a single multi-tool runbook.

ToolsPlanningCitations
Realtime voice concierge

Streams audio input, turns it into actions, and speaks back with low latency.

AudioStreamingLatency
Eval flywheel

Captures failures, generates test cases, and tracks prompt regressions over time.

EvalsTelemetryQuality
Code review assistant

Reads diffs, flags risks, and outputs structured review checklists.

CodeGuardrailsChecks
Topic hubs

Explore by topic

Jump into the cookbook areas that map to your system design and product roadmap.

Latest updates

Fresh from the lab

New recipes and updates across prompting, agents, and multimodal workflows.

Launch checklist

Production readiness

Operational guardrails to keep your gateway workloads resilient in production.

Backoff on rate limits

Honor Retry-After headers and cap concurrent streams for audio workloads.

Telemetry on every request

Log token usage, latency, tool calls, and completion status.

Prompt regression tests

Run eval suites on every prompt or model change.

Schema validation

Validate JSON outputs and retry with correction prompts.

Key rotation + scopes

Use per-environment keys and least-privilege scopes.

Human escalation path

Define when agents should hand off to an operator.

Ready for production?

Pair these recipes with eval suites, usage tracking, and environment-specific API keys before launch.

Return to API reference