# Quick start

The public API follows the OpenAI shape. If you already use an OpenAI SDK, change the base URL and the key and you are done.

## Base URL

Every endpoint in this guide lives under the base URL `https://api.novapi.ai/v1`.

## 1. Get an API key

Create a key on the key page and keep it secret. Send it as `Authorization: Bearer <key>` on every request.

- [API keys](https://www.novapi.ai/secret-key)

## 2. Pick a model

Browse the catalog for model ids, categories and prices, or call `GET /v1/models` (no key needed). Use the model id exactly as listed.

To see what a call will cost with your own discount before you submit it, see Model pricing lookup.

- [Models & pricing](https://www.novapi.ai/docs/guide/models)
- [Model catalog](https://www.novapi.ai/pricing)
- [Model pricing lookup](https://www.novapi.ai/docs/guide/pricing)

## 3. Make your first call

Replace `MODEL_ID` with a chat model id from the catalog.

```bash
curl https://api.novapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Explain quantum entanglement in three sentences."
    }
  ]
}'
```

Python (OpenAI SDK):

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.novapi.ai/v1", api_key="sk-...")

resp = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Explain quantum entanglement in three sentences."}],
)
print(resp.choices[0].message.content)
```

TypeScript (OpenAI SDK):

```python
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.novapi.ai/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "MODEL_ID",
  messages: [{ role: "user", content: "Explain quantum entanglement in three sentences." }],
});
console.log(resp.choices[0].message.content);
```

## Endpoints at a glance

| Capability | Endpoint | Mode |
| --- | --- | --- |
| Chat | `POST /v1/chat/completions` | Synchronous, optional streaming |
| Images | `POST /v1/images/generations` | Synchronous |
| Video | `POST /v1/videos`, `GET /v1/videos/{id}` | Asynchronous: create, then poll |
| Speech (TTS) | `POST /v1/audio/speech` | Synchronous, returns audio bytes |
| Speech to text | `POST /v1/audio/transcriptions`, `GET /v1/audio/transcriptions/{id}` | Waits up to about 110 seconds, else 202 and poll |
| Music (extension) | `POST /v1/audio/generations` | Asynchronous: create, then poll |
| ffmpeg (extension) | `POST /v1/ffmpeg/jobs` | Asynchronous: create, then poll |
| Models | `GET /v1/models`, `GET /api/cqt/models` | Public, no key |
| Price lookup | `GET /api/cqt/models/me`, `POST /api/cqt/generator/price-preview/{model}`, `POST /v1/videos/price-preview` | Your price list and quotes; key required |
