# 5-Minute Quickstart (API)

### 5-Minute Quickstart (API)

Prerequisites

* Create an API key in the Console.
* Note your Base URL (e.g., https\://\<your-gateway>/v1).

Recommended: store config in environment variables

```bash
export SIGHT_API_BASE="https://<your-gateway>/v1"
export SIGHT_API_KEY="sk-********************************"
```

#### cURL example:

```bash
curl -X POST \
  "https://<your-gateway>/v1/chat/completions" \
  -H "Authorization: Bearer sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role":"user","content":"Hello, SightAI!"}]
  }'
```

#### Node.js (fetch):

```javascript
const res = await fetch("https://<your-gateway>/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.SIGHT_API_KEY,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "Hello" }]
  })
});
const data = await res.json();
console.log(data);
```

#### Python (requests):

```python
import os, requests
url = "https://<your-gateway>/v1/chat/completions"
headers = {"Authorization": f"Bearer {os.environ['SIGHT_API_KEY']}",
           "Content-Type": "application/json"}
payload = {
  "model": "gpt-4o-mini",
  "messages": [{"role":"user","content":"Hello"}]
}
r = requests.post(url, headers=headers, json=payload, timeout=60)
print(r.status_code, r.json())
```

> Note: Streaming (SSE) and function/tool calls follow the OpenAI style. See “API Quickstart & Advanced Examples” for samples.
