# Quickstart

> Three steps to call AI through KONG API AI: create an account, create a key, and send your first request with cURL, Python or Node.js.

Source: https://kongapiai.com/en/docs/quickstart

## 1. Create an account

Open the [sign-up page](https://kongapiai.com/app#signup) and enter an email and a password. Every account starts on the Free plan. No card is needed.

## 2. Create a key

In the console, open **API Keys** and create a key. A key starts with `gw_live_` or `gw_test_`.

> A key is shown in full only once, when it is created. Copy it to a safe place right away. If you lose it, revoke that key and create a new one.

## 3. Send your first request

The base URL of the API is:

```text
https://kongapiai.com/v1
```

Replace `gw_live_…` with your key and `MODEL_ID` with a model from [Models and prices](https://kongapiai.com/en/docs/models).

```bash cURL
curl https://kongapiai.com/v1/chat/completions \
  -H "Authorization: Bearer gw_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "messages": [{"role": "user", "content": "Hello"}]}'
```

```python
# pip install openai
from openai import OpenAI
import uuid

client = OpenAI(base_url="https://kongapiai.com/v1", api_key="gw_live_…")
r = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={"Idempotency-Key": str(uuid.uuid4())},
)
print(r.choices[0].message.content)
```

```js
// npm install openai
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://kongapiai.com/v1", apiKey: "gw_live_…" });
const r = await client.chat.completions.create(
  { model: "MODEL_ID", messages: [{ role: "user", content: "Hello" }] },
  { headers: { "Idempotency-Key": crypto.randomUUID() } },
);
console.log(r.choices[0].message.content);
```

## Why send an Idempotency-Key

`Idempotency-Key` is an ID you generate for each request. If the network drops and your code sends the same request again with the same ID, KONG API AI does not call the provider a second time and does not charge twice. Details are on the [API](https://kongapiai.com/en/docs/api) page.

## Next steps

- Put a limit on each key: [Limits and routing](https://kongapiai.com/en/docs/limits).
- Put the key into Claude Code, Codex or Cursor: [Set up your tool](https://kongapiai.com/en/docs/tools).
- Handle errors in code: [Errors](https://kongapiai.com/en/docs/errors).
