> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/ai/ai-model-hub/faqs.md).

# 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 is usage measured?

Usage is measured per request, and the unit depends on the type of model.

For [<mark style="color:blue;">Large Language Models</mark>](/cloud/ai/ai-model-hub/models/llms.md), [<mark style="color:blue;">Coding Models</mark>](/cloud/ai/ai-model-hub/models/coding-models.md) and [<mark style="color:blue;">OCR Models</mark>](/cloud/ai/ai-model-hub/models/ocr-models.md), usage is measured in tokens: the input tokens sent to the model and the output tokens it generates. Input covers everything sent as part of the request, and output everything the model produces in response.

[<mark style="color:blue;">Embedding Models</mark>](/cloud/ai/ai-model-hub/models/embedding-models.md) and [<mark style="color:blue;">Reranking Models</mark>](/cloud/ai/ai-model-hub/models/reranking-models.md) are measured on input tokens only, at a single rate rather than separate input and output rates. These models return vectors or relevance scores rather than generated text, so no output tokens arise. For a reranking request, the input counted is your query together with all the documents you submit.

[<mark style="color:blue;">Text to Image Models</mark>](/cloud/ai/ai-model-hub/models/image-generation-models.md) are not measured in tokens. Each model is billed according to its own unit, which varies by model. If a single request generates several images, each one counts separately. Where a model works from an existing image, for example to edit or vary it, the input image counts towards the request as well.

For the unit and the price that apply to each model, see [<mark style="color:blue;">Prices</mark>](https://docs.ionos.com/cloud/support/general-information/price-list).

### How are retries counted?

Each request is measured on its own. Attempts are not matched up or combined, so a retry counts separately from the attempt before it.

This is worth keeping in mind when an earlier attempt had already produced output, either because it was cut short after generation began or because your application rejected its response and reissued the request. That output counts too, alongside the retry. Retry logic configured in your client therefore has a direct effect on your total usage.

### Is repeated or cached input discounted?

Not currently. Repeated input is measured at the standard input rate.

Prompt caching is applied automatically, so a request that repeats a long identical prefix may return faster than the first time it was sent. Billing does not yet reflect this: cached and new input tokens are counted alike, so a request is measured on its full input.

### Do system prompts and tool definitions count as input?

Yes. A system prompt and any [<mark style="color:blue;">tool or function definitions</mark>](/cloud/ai/ai-model-hub/advanced-concepts/tool-calling.md) you include travel to the model as part of your input, so they count as input tokens like the rest of your prompt. They are not measured separately, and they are not excluded from the count.

### 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;">Cost & 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 unit to give you detailed insight into your consumption.

**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                                   | ✅               |

### How can I retrieve my usage programmatically?

In addition to the DCD, you can retrieve your usage through the [<mark style="color:blue;">IONOS CLOUD Billing API</mark>](https://api.ionos.com/docs/billing/v3/) and integrate it into your own reporting or cost-attribution tooling. For an overview of the API, see [<mark style="color:blue;">Cost & Usage</mark>](/cloud/set-up-ionos-cloud/management/usage/cost-and-usage.md).

The **Utilization** endpoints offer the most granular view of AI Model Hub consumption:

* Utilization for the current billing period.
* Utilization for one specified month, in `YYYY-MM` format.
* Utilization for one specified day, in `YYYY-MM-DD` format, for day-by-day analysis within a month.

Each returns metered quantities per product code, together with the unit that applies to that meter. Input and output have separate product codes for text generation, coding, and OCR models. Embedding and reranker models have a single product code. The **Usage** endpoints return aggregated totals for the current billing period, without the daily breakdown.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
