# API

{% hint style="info" %}
**Fair-use limits:** To ensure a reliable experience for all users, the AI Model Studio is subject to the following fair-use limits:

* **Parallel training:** Usage is limited to one active training process per user.
* **Inference capacity:** Limited to a maximum of three parallel queries per user.
* **Synthetic data generation:** Generation is limited to a maximum of 100 units per operation, with one parallel generation process allowed.

To increase the limits, contact [<mark style="color:blue;">IONOS Cloud Support</mark>](https://docs.ionos.com/cloud/support/).
{% endhint %}

The AI Model Studio can be used for inference tasks through API to be integrated into AI applications or for running more sophisticated evaluations. The following paragraphs explain how and which specifications the API can access.

## Create an access token

Authentication to access your personal fine-tuned models in handled via `bearer token`. To create a token, click on your user name in the top right corner of the AI Model Studio web UI and navigate to *Organizational Settings*. API tokens will be created in the *API Keys* tab.

{% hint style="warning" %}
**Important:** As the AI Model Studio is not fully integrated into the DCD ecosystem, IONOS Cloud API tokens created within the IONOS DCD cannot be used to access the Model Studio API. You must generate tokens directly within AI Model Studio to access its API.
{% endhint %}

## Endpoints

**Best Practice:** You can generate ready to use code for API calls to your model within the AI Model Studio. Go to the **Models** section inside the web UI, select the model you want to use, and click on `<>`.

### Create a Generation Job

```bash
POST https://studio.ionos.de/api/v1/organizations/<YOUR_ORGANIZATION_ID>/generate
```

**Request Body**:

```json
{
  "model_id": MODEL_ID,
  "messages": [
    [
      {
        "role": "user",
        "content": "The capital of France is"
      }
    ]
  ],
  "temperature": 0.7,
  "max_tokens": 512
}
```

**Response:**

```json
{
  "job_id": JOB_ID,
  "status": "CREATED",
  "message": "Generation job created successfully"
}
```

### Retrieve the Generated Output

```bash
`GET` https://studio.ionos.de/api/v1/organizations/<YOUR_ORGANIZATION_ID>/generate/<JOB_ID>
```

**Response:**

```json
{
  "job_id": JOB_ID,
  "job_status": "FINISHED",
  "total_tasks": 1,
  "completed_tasks": 1,
  "results": [
    {
      "task_index": 0,
      "status": "completed",
      "result": " Paris, known for its iconic Eiffel Tower, rich history, and vibrant culture."
    }
  ]
}
```
