> For the complete documentation index, see [llms.txt](https://docs.onlymonster.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onlymonster.ai/ai-magic-assistant/ai-gateway.md).

# AI Gateway

AI Gateway is where your agency connects its own AI provider and saves reusable model setups, called presets. Custom translators run on these presets, which means translations are produced by your own model instead of the built-in OnlyMonster engine.

*AI Gateway is currently in Beta.*

### How It Works

There are four steps between an empty setup and a working custom translation:

1. **AI Tools → AI Gateway** — add an OpenRouter API key.
2. **AI Tools → AI Gateway** — create a preset: select a model and set its parameters.
3. **AI Tools → Translate → Translators** — create a custom translator and select the preset.
4. **AI Tools → Translate → Accounts** — connect the translator to your accounts.

Steps 1 and 2 are covered in this article. For steps 3 and 4, see [Custom Translators](https://docs.onlymonster.ai/ai-magic-assistant/custom-translators) and [Connecting Translators to Accounts](https://docs.onlymonster.ai/ai-magic-assistant/connecting-translators-to-accounts).

### Where to Find It

Open **AI Tools → AI Gateway** — the same sidebar section as **Translate**.

The module contains two lists: **API Keys** and **All Presets**.

### Before You Start

|                        |                                                      |
| ---------------------- | ---------------------------------------------------- |
| Provider               | OpenRouter only                                      |
| Configuration level    | Organization: presets are shared across all accounts |
| API key limit          | Up to 5 keys per organization                        |
| Preset limit           | Unlimited                                            |
| Where presets are used | Custom translators in AI Translate                   |

### Step 1. Add an API Key

1. Click **New API Key**.
2. Follow the **OpenRouter** link and create a key on the provider's side.
3. Paste the key into the **Paste Your API key** field. OpenRouter keys start with `sk-or-`.
4. Enter a name in the **Enter Key Name** field — this is how you will recognize the key in lists.
5. Click **Add**.

The key is validated with the provider before it is saved. An invalid key is not saved, and an error message is displayed.

{% hint style="info" %}
The full key is visible only while you are entering it. After saving, it is displayed in masked form (`sk-or-v1-e4f*******a427`) and cannot be recovered — neither in the interface nor through support. To replace a key, delete the old one and add a new one.&#x20;
{% endhint %}

### Step 2. Create a Preset

A preset combines a model, an API key and a set of parameters. At least one valid API key is required.

1. Click **New Preset**.
2. **Preset Name** — the name of the preset. It is displayed when you create a translator.
3. **API Key** — select a saved key or add a new one with **+ New API Key**.
4. **Model** — select a model.
5. Adjust the values in **Model Settings** if needed.
6. Click **Create Preset**.

The **Create Preset** button stays inactive until all required fields are filled in.

#### Choosing a Model

The model list is loaded directly from OpenRouter and has two tabs:

* **Featured** — a short curated list
* **All** — the full list with search

Each model displays its input and output token price, the provider name and the context size, when the provider returns this data.

{% hint style="info" %}
The model list is always loaded online. If OpenRouter is unavailable, an error and a retry button are displayed instead of the list.&#x20;
{% endhint %}

#### Model Settings

Model settings control how the model produces its response. Basic parameters are shown immediately; the rest are available under **Show Advanced**. Fields are pre-filled with OnlyMonster defaults. Clear a field to fall back to the provider's own default.

| Parameter   | What it controls                                                                                                                                                                                                                   | OM Default | Range                                                  |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------ |
| Temperature | How predictable the output is. A lower value keeps translations closer to the original; a higher value makes them freer and more varied                                                                                            | 0.7        | 0.0 – 2.0                                              |
| Max Tokens  | The maximum length of the model's response. A value that is too low will cut off long messages                                                                                                                                     | 800        | 1 and above (maximum = model context minus the prompt) |
| Top P       | How wide a range of words the model considers at each step: 1.0 means all options, lower values keep only the most likely ones. It affects variety the same way Temperature does, so it is usually best to change only one of them | 0.7        | 0.0 – 1.0                                              |

Advanced parameters (**Show Advanced**):

| Parameter          | What it controls                                                                                                        | Default | Range                |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------- | -------------------- |
| Frequency Penalty  | Penalizes repeated words: the more often a word has already appeared, the less likely the model is to use it again      | 0       | -2.0 – 2.0           |
| Presence Penalty   | Penalizes words that have already been mentioned, regardless of how often. Pushes the model towards new wording         | 0       | -2.0 – 2.0           |
| Top K              | Limits the choice to a fixed number of the most likely words at each step. `0` means no limit                           | 40      | integer, 0 and above |
| Min P              | Filters out words that are far less likely than the most likely option. `0.0` means no limit                            | 0.05    | 0.0 – 1.0            |
| Repetition Penalty | A general penalty for repetition across the whole text. Values above 1.0 strengthen the penalty, values below weaken it | 1.05    | 0.0 – 2.0            |
| Stop Sequences     | Strings that make the model stop generating                                                                             | empty   | list of strings      |

{% hint style="info" %}
For translation, adjusting **Temperature** and **Max Tokens** is usually enough. Change the other parameters only if you know how the model responds to them, and check the result with **Test Translator** in the translator itself.&#x20;
{% endhint %}

Reasoning is not available: it is always off. A notice at the bottom of **Model Settings** confirms this — *Reasoning off by default for supported models*.

### Editing and Deleting

**Editing a preset.** After you save, all new requests use the updated settings. Requests that are already running finish with the previous ones.

**Deleting a key or a preset.** Both actions require confirmation.

**If you delete an API key,** the presets that use it are not deleted. They switch to the **invalid key** status and stop working. To restore them, open the preset, select another valid key, and save. Translators running on such a preset stop translating until the preset is fixed.

### Permissions

| Permission      | What it allows                  |
| --------------- | ------------------------------- |
| View AI Gateway | Opens the module and both lists |
| Edit API Keys   | Add and delete API keys         |
| Edit Presets    | Create, edit and delete presets |

**Edit API Keys** and **Edit Presets** only work together with **View AI Gateway**, and they are independent of each other — a member can be granted just one of them. Without an edit permission, the lists are visible but all actions stay inactive.

{% hint style="info" %}
If a team member reports that buttons are inactive or that they cannot create anything, check their role permissions first.
{% endhint %}


---

# 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.onlymonster.ai/ai-magic-assistant/ai-gateway.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.
