# Quickstart

Get the AVCodex API talking to your AVCodex agent in two minutes.

---

> **Note:** API access requires a Builder plan or higher. Free accounts cannot access the API. [Upgrade to Builder](https://app.avcodex.com/plans)

## 1. Get your API key

[app.avcodex.com](https://app.avcodex.com) > Your agent > Share > Share via API > Copy API key.

## 2. Make a request

```bash
curl https://app.avcodex.com/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "myagent-123",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

## Key points

- **Endpoint:** `POST https://app.avcodex.com/api/v1/chat/completions`.
- **Model:** your agent's ID (format: `agentname-123`).
- **Auth:** Bearer token in the header.
- **Body:** OpenAI-compatible format.

## Response

```json
{
  "chatSessionId": "550e8400-e29b-41d4-a716-446655440000",
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "Response text here"
    }
  }]
}
```

## Continue a conversation

Include `chatSessionId` from the previous response:

```json
{
  "model": "myagent-123",
  "chatSessionId": "550e8400-e29b-41d4-a716-446655440000",
  "messages": [{"role": "user", "content": "Follow up"}]
}
```

## OpenAI SDK

```javascript
import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: process.env.AVCODEX_API_KEY,
  baseURL: 'https://app.avcodex.com/api/v1'
});

const response = await openai.chat.completions.create({
  model: 'myagent-123',
  messages: [{ role: 'user', content: 'Hello' }]
});
```

*AVCodex · Your AV expertise. Amplified by AI.*