← All guides

Build an app with the Chat Completions API

Understand the request shape, authentication, and model selection for a custom chat application.

Three connection values

Your backend needs the UnsavedAi base URL ending in /v1, an API key, and an available model ID. Send POST requests to the base URL plus /chat/completions, with Authorization: Bearer YOUR_KEY and Content-Type: application/json.

The request body

Send a model string, a messages array containing role and content objects, and a max_tokens output limit. Set stream to true for incremental output. The Docs page includes a copyable curl example.

Keep keys on the backend

Never bundle the account key into a public website or mobile application. Authenticate your own users and call UnsavedAi from your backend. Give development and production separate named keys so you can revoke one without replacing the other.

Your next step

Check available models, open your console, or read the API documentation. Public signup and paid plans are still being prepared.