# First API request

## Prepare
Create an API key and confirm a model ID available to it. The examples read `AOXTOKEN_API_KEY` and `AOXTOKEN_MODEL` from the environment. Never commit real keys.

The curl example uses macOS/Linux shell syntax; Windows users can run it in an already configured WSL environment. Use the exact model ID from the service without extra characters such as quotes.

## curl

```bash
curl --fail-with-body https://api.aoxtoken.com/v1/chat/completions \
  -H "Authorization: Bearer $AOXTOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"$AOXTOKEN_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with OK\"}],\"stream\":false}"
```

## Python

Install the OpenAI Python SDK (`pip install openai`), set the environment variables and run:

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AOXTOKEN_API_KEY"],
    base_url="https://api.aoxtoken.com/v1",
)
response = client.chat.completions.create(
    model=os.environ["AOXTOKEN_MODEL"],
    messages=[{"role": "user", "content": "Reply with OK"}],
)
print(response.choices[0].message.content)
```

## JavaScript

Install the OpenAI JavaScript SDK (`npm install openai`), save the example as `request.mjs`, set the environment variables and run it with Node.js:

```javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AOXTOKEN_API_KEY,
  baseURL: "https://api.aoxtoken.com/v1",
});
const response = await client.chat.completions.create({
  model: process.env.AOXTOKEN_MODEL,
  messages: [{ role: "user", content: "Reply with OK" }],
});
console.log(response.choices[0].message.content);
```

## Acceptance
All three examples still require execution with a test key, an actual model and recorded SDK versions. The expected result is text output plus a matching AoxToken usage record. Until then, these examples are not live-tested instructions. See [Troubleshooting](/docs/en/troubleshooting/) for failures.
