> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings/connect-to-ai-gateway.md). Agents can also search and read this documentation through its [MCP server](https://docs.uptiq.ai/~gitbook/mcp).

# Connect to AI Gateway

Create a gateway API key and send model requests through AI Gateway from your own applications.

Your own applications can send model requests through the same gateway your agents use, with the same families, tiers, and failover. Select **Connect** at the top of [Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md) to open **Connect to AI Gateway**. It lets you create a key, then call the gateway from any client, in or out of the platform.

AI Gateway offers OpenAI-compatible and OpenRouter-compatible endpoints. Existing tools and SDKs can point at the Uptiq Platform's base URL with a gateway API key and call chat completions, responses, models, and embeddings. Usage is tracked.

Only **Account Admin** and **Org Admin** can create and revoke gateway API keys. See [Roles](https://docs.uptiq.ai/platform/control-center/admin/roles.md).

{% stepper %}
{% step %}

#### Create a key

Under **API keys**, select **Create API Key** and enter a **Key name**; a key can't be created without one. The key is shown once, right after it is created, so copy it then. The example request in the window fills in the new key. The list shows each key's **Name**, **Created** date, and **Status**, and shows **No results.** before you create one. Every key in this list carries the AI gateway permission. You can revoke a key at any time; revoking asks you to confirm first. A gateway API key authenticates calls to AI Gateway. It isn't the same as a provider key you enter under **Bring your own key**.
{% endstep %}

{% step %}

#### Send a request

Copy the example from the dialog. It already contains your deployment's address. The request looks like this:

```bash
curl -X POST "https://<your-api-host>/identity-hub/ai-gateways/chat/completions" \
  -H "x-platform-key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "tier": "smart",
    "messages": [{ "role": "user", "content": "Hello" }]
  }'
```

{% endstep %}
{% endstepper %}

| Part of the request     | What to know                                                                                     |
| ----------------------- | ------------------------------------------------------------------------------------------------ |
| `x-platform-key` header | Authenticates the call. The key belongs to one account, so no account header is needed.          |
| `tier`                  | `economy`, `smart`, or `premium`. The gateway picks the model and fails over for you.            |
| `model`                 | Use instead of `tier` to name one model, for example `claude-sonnet-4-6`.                        |
| Body                    | OpenAI-compatible. `messages`, `tools`, `stream`, and `response_format` behave as they do there. |

{% hint style="info" %}
A `response_format` asking for JSON is a preference, not a guarantee. Validate the reply's shape yourself. See [Requests for JSON or a response schema](https://docs.uptiq.ai/platform/control-center/ai-gateway/how-model-routing-works.md#requests-for-json-or-a-response-schema).
{% endhint %}

## What's next

{% content-ref url="/pages/vHMstiaitwTfebCHvC8Q" %}
[How Model Routing Works](https://docs.uptiq.ai/platform/control-center/ai-gateway/how-model-routing-works.md)
{% endcontent-ref %}

***

{% columns %}
{% column width="83.33333333333334%" %}

<p align="right"><em>Maintained by</em> <mark style="color:green;">Abhishek Paul</mark><br><code>AI-assisted, human-approved</code></p>
{% endcolumn %}

{% column width="16.666666666666664%" %}

<div align="left"><img src="https://1326225582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0qmgQjJ5aArDTj2ACFHG%2Fuploads%2Fgit-blob-d034645b4f8f8ee661985f5306b60ded3289653c%2Fmaintainer-abhishek-paul.png?alt=media" alt="" width="60"></div>
{% endcolumn %}
{% endcolumns %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings/connect-to-ai-gateway.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
