Domain
LLM API integration
Calling model provider APIs reliably: authentication, streaming, timeouts, retries, rate limits, errors and cost tracking.
0 of 15 articles published. Topics are listed in reading order: each comes after the topics it builds on.
Calling a model API
The request and response cycle of a hosted model API, end to end.
- The life of an LLM API requestComing soon
Every hop from the user's click to the streamed answer, and where time and money are spent along the way.
Fundamentals · Beginner
- Messages, roles and system instructionsComing soon
How chat APIs structure a conversation, and what system, user and assistant messages are for.
Fundamentals · Beginner
- Managing provider API keysComing soon
Keeping keys on the server, scoping and rotating them, and detecting leaks.
Security · Intermediate
- Streaming responses with server-sent eventsComing soon
Relaying tokens to the browser as they arrive, handling disconnects, and assembling the final message.
Implementation · Intermediate
- Structured output and schema validationComing soon
Asking for JSON that matches a schema, validating it, and recovering when the model gets it wrong.
Implementation · Intermediate
Reliable model calls
Keeping an application working when the provider is slow, overloaded or failing.
- Provider errors and how to classify themComing soon
Which errors are worth retrying, which mean the request is wrong, and which mean stop.
Fundamentals · Intermediate
- Timeouts for model callsComing soon
Connect, first-token and total timeouts, and how streaming changes what a timeout means.
Configuration · Advanced
- Retries with backoff and jitterComing soon
Bounded retries that do not amplify an outage, and when a retry needs an idempotency key.
Implementation · Advanced
- Working within provider rate limitsComing soon
Request and token limits, reading rate-limit headers, and queueing work instead of failing it.
Operations · Advanced
- Falling back to another model or providerComing soon
Designing a fallback chain, handling behavioural differences between models, and knowing when not to fall back.
Architecture · Production
Provider abstraction
Isolating the application from any one provider's SDK and quirks.
- Designing a model provider interfaceComing soon
A small interface that hides provider differences without hiding the features you rely on.
Architecture · Advanced
- Testing model integrations with fakesComing soon
Deterministic fakes and recorded responses for unit and integration tests, and what they cannot catch.
Implementation · Advanced
Usage and cost
Knowing what each call costs and keeping spend under control.
- Counting tokens and tracking cost per requestComing soon
Recording input, output and cached tokens per request so cost can be attributed to features and tenants.
Implementation · Intermediate
- Spending budgets and per-user quotasComing soon
Enforcing daily budgets and per-user limits atomically, and failing in a way users understand.
Operations · Production
- Batch APIs for offline workloadsComing soon
When asynchronous batch processing fits, and how to track, retry and reconcile batch jobs.
Implementation · Advanced