Production AI integrations need conventional distributed-systems discipline plus model-specific validation. Use this checklist before exposing a Yelu-backed feature to users.
Discover capabilities
Query GET /v1/models and keep model selection in configuration. A catalog entry means the key can route to the model; verify vision, tools, structured output, audio, and other capabilities with a contract test.
Set explicit boundaries
- Set connect, read, and total deadlines for every request.
- Bound input bytes, message count, tool schema size, image dimensions, audio size, and output tokens.
- Limit tool-loop iterations and concurrent model calls per user.
- Use server-side cancellation when the caller disconnects.
- Reject unknown user-selected models unless they are in an allowlist built from the current catalog.
Retry selectively
Retry 429 and temporary 5xx responses with exponential backoff, jitter, and a small total retry budget. Do not retry invalid or unauthorized requests unchanged. See Rate limits.
Protect data and keys
- Keep Yelu keys in server-side secret storage and use one key per environment/workload.
- Redact authorization, prompts, tool arguments, files, and model output from default logs.
- Classify data before sending it to any AI model and enforce your retention and residency requirements.
- Treat model output, URL input, and function arguments as untrusted.
- Require deterministic authorization for every tool action.
Make outputs dependable
- Use structured output for machine-consumed data and validate it locally.
- Use low randomness for extraction, classification, and workflow control.
- Check finish status before consuming output;
length and content filtering can produce incomplete results.
- Maintain versioned evaluation cases for prompts, schemas, model changes, and fallback behavior.
- Make fallback models explicit because quality, safety, latency, and output shape can differ.
Observe the system
Record enough metadata to debug without collecting unnecessary content:
Control cost
- Choose the smallest model that passes your evaluation threshold.
- Trim conversation history and retrieve only relevant context.
- Cap output, image count, dimensions, and audio duration.
- Deduplicate safe, deterministic work at the application layer.
- Attribute usage with separate keys and dashboard monitoring.
Never silently switch to a model with materially different safety or data-handling characteristics. Treat fallback as a product and compliance decision, not only a reliability mechanism.