API & concepts
Practical guides for developers and creators: connect your tools, pick the right model, write better prompts and keep your AI bill down.
Embeddings explained: what they are and how to use them
Embeddings turn text into numbers that capture meaning. Learn how they power search, recommendations and RAG, with code.
Send images to AI models (vision) with the API
How to include images in chat requests as URLs or base64, with examples for screenshots, receipts and charts.
Getting reliable JSON from AI models
Techniques for structured output: JSON mode, schemas, validation and retries, so your code never chokes on a malformed answer.
Handling AI API errors and retries the right way
Which errors are safe to retry, how to back off, and how to make AI features degrade gracefully instead of breaking.
Dealing with 429 Too Many Requests
Why rate limits happen, how to stay under them with queues and concurrency limits, and how to retry correctly.
AI API error codes explained: 400, 401, 402, 403, 404, 429, 5xx
A plain-English guide to every common error you'll see from an AI API, what causes it, and how to fix it.
How chat memory works (and how to keep it cheap)
AI APIs are stateless: you send the whole conversation every time. Here's how to manage history without exploding costs.
Discover available models with GET /v1/models
Use the models endpoint to list what's available, build a model picker, and avoid hard-coding model names.
Timeouts and long AI responses: avoiding cut-offs
Long generations can exceed default HTTP timeouts. Here's how to set timeouts, stream, and design for slow responses.
Function calling (tool use) explained with a working example
How models call your functions: define tools, run them, send results back. A complete Python example with a weather tool.
Streaming AI responses with Server-Sent Events (SSE), explained
Why streaming makes AI apps feel fast, what the SSE stream looks like, and how to parse it correctly in Python, Node and the browser.