> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adaptive-ml.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Access

> Configure API access for the SDK and HTTP requests

## Find your credentials

You need two values from your Adaptive deployment:

| Credential         | Description           |
| ------------------ | --------------------- |
| `ADAPTIVE_URL`     | Your deployment URL   |
| `ADAPTIVE_API_KEY` | Your personal API key |

<Frame caption="Copy your API key from the top left navigation switcher">
  <img src="https://mintcdn.com/adaptiveml/R5QotOduSKbjj2fS/static/api_key-0-11.png?fit=max&auto=format&n=R5QotOduSKbjj2fS&q=85&s=8f30532126ac533d392e6dc4d10b0439" width="852" height="1238" data-path="static/api_key-0-11.png" />
</Frame>

Click the navigation switcher in the top left corner (labeled *View all use cases*) to reveal your API key. Your deployment URL is provided by your administrator.

## Set environment variables

```bash theme={null}
export ADAPTIVE_URL="https://your-deployment.adaptive-ml.com"
export ADAPTIVE_API_KEY="your-api-key"
```

The SDK and HTTP clients use these environment variables to connect to Adaptive.

<Accordion title="Alternative: OpenAI client">
  Use the OpenAI Python library with your Adaptive deployment:

  ```python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      base_url=f"{os.environ['ADAPTIVE_URL']}/api/v1",
      api_key=os.environ["ADAPTIVE_API_KEY"],
  )

  response = client.chat.completions.create(
      model="use_case_key/model_key",
      messages=[{"role": "user", "content": "Hello!"}],
  )
  ```

  Set `model` to `use_case_key/model_key`.
</Accordion>

<Accordion title="Alternative: HTTP requests">
  Include your API key in the `Authorization` header:

  ```
  Authorization: Bearer ADAPTIVE_API_KEY
  ```

  ```bash theme={null}
  curl "$ADAPTIVE_URL/api/v1/chat/completions" \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ADAPTIVE_API_KEY" \
    -d '{
      "model": "use_case_key/model_key",
      "messages": [{"role": "user", "content": "Hello!"}]
    }'
  ```
</Accordion>
