AI Gateway
An AI gateway is your application's shared access point to AI models. In each gateway, you select the models you need, and your application sends all its requests to these models through the gateway's domain. For example, if your application uses one model to answer users and another model to summarize text, you select both models in one gateway, and the application can access both with one address and one access key.
A gateway isn't an AI model. It's the access path to models and the place where you manage settings such as guardrails, knowledge bases, and request rate limits.
Creating an AI gateway is free. The cost of using models is calculated based on input and output token usage and deducted from your wallet.
Gateway Domain
Each gateway is available through a domain. When creating a gateway, you choose one of the following two domain types. Model selection and customization are available for both domain types.
- Free Arvancloud domain
Arvancloud assigns this domain to the gateway automatically, and you don't need your own domain to use it.
Note that you can use the free Arvancloud domain only once, and you can't delete the gateway you create with this domain. To create more gateways, use your own domain.
- Custom domain If you want the gateway to be available at your own address, connect one of your domains to the gateway. You can also set up the gateway on a subdomain, such as ai.example.com.
Creating a Gateway
To create a gateway, click the New AI Gateway button in the AI Gateway List section of the AI service menu.
The gateway creation form consists of the Basic Information, AI Domain, Model Selection, and Advanced Settings sections. As you fill in the form, a summary of the gateway's settings is shown in the Specifications column.
Basic Information and Domain
- Name Enter a name to identify the gateway in the gateway list. The panel suggests a default name, which you can change. This field is required.
- AI Domain Select Free Arvancloud Domain or Custom Domain.
If you selected Custom Domain, click the Select Domain field and choose your domain from the list. To set up the gateway on a subdomain, enable Set Subdomain and enter the subdomain name, such as ai, in the Subdomain field.
Model Selection
By default, all models are selected for the gateway. To change the gateway's models, click Customize in the Model Selection section.
In the Model Selection window, click the checkbox next to each model's name to remove it from the gateway or add it. To find a model, enter its name in the Search Models field. The checkbox in the Models column header deselects all models at once; so if you need only a few models, first deselect all and then select the models you want.
Then click Apply.
Deselecting a model only removes the gateway's access to that model and doesn't delete the model or the gateway.
Note that in a gateway created with the free Arvancloud domain, at least one model must always stay connected, and you can't deselect the last model.
Advanced Settings
In this section, you can enable a guardrail, a knowledge base, and a request rate limit for the gateway. All three settings are optional.
- Guardrail By enabling this option, you connect one of the guardrails you have already created to the gateway, so the content of requests and responses is checked for sensitive data, abuse, and inappropriate content. The type of control and how content is handled depend on that guardrail's configuration, and enabling this option doesn't mean all types of protection are enabled. The Guardrail guide helps you create a guardrail.
- Knowledge Base By enabling this option, you connect one of the knowledge bases you have already created to the gateway, so the models generate their answers based on your documents and data. This doesn't retrain the model, and the quality of answers depends on how relevant, complete, and up to date the knowledge base's content is. The guide to creating a knowledge base helps you with this.
- Request Rate Limit
By enabling this option, you limit the number of requests the gateway accepts in a time period. Enter the request cap, such as 50, in the Number of Requests field, and select the time period, such as 5 minutes, from the Per... list. Then click Confirm. The Confirm button only saves the values of this section in the form and doesn't create the gateway.
The rate limit only controls the number of requests and isn't the same as a token limit or spending cap. Set its value according to your application's expected traffic.
After completing the form and reviewing the settings summary in the Specifications column, click the Create AI Gateway button.
Using the Gateway
After it's created, the gateway is shown in the AI Gateway List. Click the gateway's name to open its page. The gateway's address is shown in the Specifications tab as AI gateway address, and consists of the gateway's domain and the /v1 path, such as https://ai.example.com/v1.
To send requests to the gateway, you need an access key. Get the access key by creating a machine user. The Machine User guide helps you with this.
To send requests to the gateway's models, you can use the following sample request:
curl --location 'https://ai.example.com/v1/chat/completions' \
--header 'Authorization: apikey ****' \
--header 'Content-Type: application/json' \
--data '{
"model": "Gemini-2.5-Pro",
"messages": [
{"role": "user", "content": "Why is the sky blue?"}
],
"max_tokens": 3000,
"temperature": 0.7
}'
Replace the gateway address and access key with your own in this request.
The model value is the name of one of the models you selected for the gateway. messages is the list of conversation messages, and each message has a role, such as user, and a content. max_tokens sets the maximum number of tokens the model generates in the response, and temperature sets how varied the response is; the lower this value, the more predictable the responses. The gateway also works with OpenAI-compatible libraries. The OpenAI SDK code samples help you with this.
If you get an error in the response, use the following table:
| Error | Solution |
|---|---|
| 401 Unauthorized | Make sure the access key is valid and is in the Authorization header. |
| 429 Too Many Requests | The number of requests has exceeded the gateway's rate limit. Check the Request Rate Limit value in the gateway settings. |
| Empty response | Make sure the request body is valid JSON and has the messages field. |
Requests are independent of each other, and the gateway has no memory of previous requests.
Managing the Gateway
On each gateway's page, change the models connected to the gateway in the Models tab, and connect a guardrail or knowledge base to the gateway in the Guardrail and Knowledge Base tabs. The Monitoring tab shows the gateway's input and output tokens over different time periods.