Artigos de Using the AI API

Using the AI API 286 Showing the AI reply as it is written in your website or app (streaming) In short: send stream: true in your chat request and the reply arrives in pieces, as the model writes it. That is...
Using the AI API 100 Your first AI request with curl: the address, the key and the model In short: an AI request needs three things: the address https://api.mozout.com/v1/chat/completions, the key in the...
Using the AI API 89 Apps made for Claude: the Anthropic Messages format at /v1/messages In short: if your program was built with the Anthropic SDK, or you use Claude Code, you do not have to rewrite it....
Using the AI API 90 The OpenAI Responses format: /v1/responses and responses kept for 30 days In short: besides OpenAI chat, the API accepts the OpenAI Responses format, at POST /v1/responses. It is what Codex...
Using the AI API 87 Listing the AI models through the API: GET /v1/models with type and q In short: GET /v1/models returns every model on sale, with the type and the price in credits of each one. Filter...
Using the AI API 68 Sending tools (function calling) in a chat request In short: tools (function calling) let the model ask your program to run a function, for example to look up an...
Using the AI API 56 AI API errors: 402, 403, 404, 422, 429 and 502, and what to do in each case In short: when an AI request fails, the answer has an HTTP status and, inside error, a stable code that says what...
Using the AI API 78 The request limit per key: 429 rate_limited and the Retry-After header In short: each key has a limit of requests per minute. When you go over it, the API answers 429 with the code...
Using the AI API 101 Errors in the OpenAI SDK: reading error.message and the HTTP status In short: when a request fails, the OpenAI SDK reads the message from error.message and raises an exception with the...
Using the AI API 52 Not paying twice for a generation: the Idempotency-Key header In short: if the connection drops in the middle of a generation request, you do not know whether the image or the...
Using the AI API 63 Keeping your AI key safe: only on your server, never in the browser or a mobile app In short: whoever has your key spends your AI credits. So the key stays only on your server, in an environment...
Using the AI API 71 An OpenAI and Anthropic compatible AI gateway: the formats and addresses that work All in One AI is an AI gateway that speaks the formats most programs already know. Everything lives at the same...
Using the AI API 50 One key for text, image, video and voice models in the AI gateway In the MozOut AI gateway there is no separate key for chat and another for images. The same key from the API Center...
Using the AI API 57 Moving an app from a direct AI account to the AI gateway: what to change, step by step Do you have a program that already talks directly to an AI company and want to move it to the MozOut gateway? In...