> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/ai/aig/ai-gateway/createaigateway.md).

# CreateAiGateway

## 1. API Description

This API (CreateAiGateway) is used to create AI gateway

{% hint style="info" %}
**Notes**

* For the authentication method of this API, refer to [Authentication](/api-reference/api-introduction/instruction/authorization.md)
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type                                                                    | Description                                                                                                                                                                      |
| --------------- | -------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| gatewayName     | Yes      | String                                                                  | <p>AI gateway name.</p><p>Length: 2 to 63 characters.</p><p>Only letters, digits, hyphens (-), and periods (.) are allowed.</p><p>Must start and end with a letter or digit.</p> |
| expireType      | Yes      | [ExpireType](/api-reference/ai/aig/datastructure.md#expiretype)         | <p>Token expiration policy type.</p><p>Valid values: LONG\_LIVED, CUSTOM.</p>                                                                                                    |
| modelAccess     | Yes      | [ModelAccess](/api-reference/ai/aig/datastructure.md#modelaccess)       | <p>Model access permission.</p><p>Valid values: UNLIMITED, LIMITED.</p>                                                                                                          |
| modelUuids      | No       | Array of String                                                         | <p>List of model UUIDs to associate.</p><p>Required when modelAccess is <code>LIMITED</code>.</p>                                                                                |
| dailyLimit      | No       | Integer                                                                 | Daily quota limit.                                                                                                                                                               |
| monthlyLimit    | No       | Integer                                                                 | Monthly quota limit.                                                                                                                                                             |
| tokenLimit      | No       | Integer                                                                 | Token quota.                                                                                                                                                                     |
| expireTime      | No       | String                                                                  | <p>Token expiration time.</p><p>Required when expireType is <code>CUSTOM</code>.</p>                                                                                             |
| resourceGroupId | No       | String                                                                  | Resource group ID where the AI gateway will be placed after creation. If not specified, the default resource group is used.                                                      |
| tags            | No       | [TagAssociation](/api-reference/ai/aig/datastructure.md#tagassociation) | <p>Tags associated when creating the AI gateway.</p><p>Note: Associated <code>tag keys</code> must not be duplicated.</p>                                                        |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| gatewayUuid    | String | AI gateway UUID.                                                                                                      |
| token          | String | AI gateway token.                                                                                                     |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}

1. **Create an AI gateway.**

```json
POST / HTTP/1.1
Host: console.zenlayer.com/api/v2/aigw
Content-Type: application/json
X-ZC-Action: CreateAiGateway
<Common Request Params>

Request:
{
    "gatewayName": "AI-Gateway-01",
    "tokenLimit": 1000,
    "expireType": "CUSTOM",
    "expireTime": "2025-12-31T23:59:59Z",
    "resourceGroupId": "47e7f7e0-d7e9-4b28-b4b2-20da9439a294",
    "modelAccess": "UNLIMITED"
}
Response:
{
    "requestId": "TCD1C4FC9-CF4B-4E48-AA9B-63FB4D7DC191",
    "response": {
        "requestId": "TCD1C4FC9-CF4B-4E48-AA9B-63FB4D7DC191",
        "gatewayUuid": "1568676002379339603",
        "token": "sk****"
    }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
