# API

You can directly invoke Arcee Conductor via API. The Conductor API uses an OpenAI compatible endpoint making it very easy to update current applications to use Conductor.&#x20;

### Create API Key

To use the API, you first need to generate an API key.

<figure><img src="https://2302384909-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOUJInHjoAOfzq3bL12Af%2Fuploads%2FwZlzCIcEhO6ff2UUObqk%2FSelect%20API%20Key.png?alt=media&#x26;token=0aa6eec5-4e3d-4d17-a32b-0f6799161902" alt="" width="375"><figcaption><p>Select API Key</p></figcaption></figure>

Select your account at the bottom left of the page, and select "API Keys". Click "Create API Key" in the top right.

<figure><img src="https://2302384909-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOUJInHjoAOfzq3bL12Af%2Fuploads%2FaourhQU102RJjhqwhtsm%2FConductor%20create%20api%20key.png?alt=media&#x26;token=eb118288-272d-4d38-a625-0456b7feb3a5" alt="" width="375"><figcaption><p>Create API Key</p></figcaption></figure>

Provide a label/name for the key and click "Create API key". Make sure to save the key in a secure location as once you leave the page, you will not be able to view the key again. If you misplace a key, you should delete the old key and create a new one.

### API Syntax

**Request Syntax:**

```
POST https://models.arcee.ai/v1/chat/completions
Authorization: Bearer <YOUR_ARCEE_TOKEN>
Content-Type: application/json

{
  "model": "auto",
  "messages": [
    {
      "role": "user",
      "content": "Your prompt here"
    }
  ]
}
```

### Curl

```
curl -X POST https://models.arcee.ai/v1/chat/completions \
  -H "Authorization: Bearer $ARCEE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "model": "auto",
        "messages": [
          {
            "role": "user",
            "content": "Your prompt here"
          }
        ]
      }'
```

### Python

```python
# First, install the openai packages
# pip install openai

# Be sure to set the following environment variables
# OPENAI_BASE_URL="https://models.arcee.ai/v1"
# OPENAI_API_KEY="$ARCEE_TOKEN"

from openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
  model='auto',
  messages=[{'role': 'user', 'content': 'Your prompt here'}],
  temperature=0.4,
)

print(response)
```
