# FAQ

## API errors

The AI Model Hub is designed primarily as an API-first solution. While this approach enables seamless integration into existing codebases, it also presents a challenge: errors and problems that occur may not always be immediately visible or diagnosable. This FAQ addresses the most common problems and guides on their resolution:

### How do I fix an unauthorized, incorrect, or no API key error?

Our [<mark style="color:blue;">How-Tos</mark>](/cloud/ai/ai-model-hub/how-tos.md) documentation assume you have an environment variable called **IONOS\_API\_TOKEN**. The value of this environment variable needs to be a valid **Authentication Token**. If you get the described error, two reasons are possible:

* **IONOS\_API\_TOKEN** is not set: Check whether your system's environment variable is set. The simplest way to do this is by adding the line

  ```python
  import os
  print(os.environ.get("IONOS_API_TOKEN"))
  ```

  to your code. If nothing is shown, the environment variable is not set. Please set it.
* Your **Authentication Token** is not valid: If the **IONOS\_API\_TOKEN** environment variable is set, but you still see this error, your authentication token might not be valid. Create a new **Authentication Token** as described in [<mark style="color:blue;">Access Management</mark>](/cloud/ai/ai-model-hub/how-tos/access-management.md).

### How do I fix a `404 Not Found` error?

Communication with the AI Model Hub is by API endpoints. These endpoints often contain IDs, like a **Model ID** or a resource-specific identifier. If a resource has been deleted or the ID is incorrect, the request returns a `404 Not Found` error.

To confirm that the ID exists, call the parent collection endpoint with a GET request and check the returned list for the ID you intend to use.

### How do I fix a `500 Internal Server` error?

We do our best to ensure our service is operational 24 hours, 7 days a week. If `500 Internal Server` errors occur, it may be due to too much traffic on the AI Model Hub or an urgent infrastructure fix. Please retry your request. If the problem persists, contact [<mark style="color:blue;">IONOS Cloud Support</mark>](https://docs.ionos.com/cloud/support/general-information/contact-information).

## Cost & Usage

### How can I monitor the costs incurred through usage of the AI Model Hub?

You can monitor your AI Model Hub costs and usage for your contract in the [<mark style="color:blue;">Costs & Usage</mark>](/cloud/set-up-ionos-cloud/management/usage/cost-and-usage.md) section of the DCD. Usage data is broken down by model and token type, whether input or output tokens, to give you detailed insight into your consumption. It is displayed in blocks of one million tokens for embedding and large language models, and by image count for image-based models.

**Prerequisites:** You must be one of the following to access the **Cost & Usage** view:

| **Contract Type**  | **Contract Users**                                | **Accessible?** |
| ------------------ | ------------------------------------------------- | --------------- |
| Regular contracts  | <p>Contract administrators<br>Contract owners</p> | <p>✅<br>✅</p>   |
| Reseller contracts | Contract owners                                   | ✅               |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/ai/ai-model-hub/faqs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
