Update AI Gateway Settings
Endpoint
PUT /apiops/settings/ai-gateway
Authentication
Requires a Personal API Access Token with admin privileges.
Header
Authorization: Bearer YOUR_TOKEN
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
| Content-Type | application/json | Yes |
Path Parameters
None.
Query Parameters
None.
Request Body
This is a partial update: only the top-level fields you send (non-null) are applied — every omitted field preserves its currently stored value.
Full JSON Body Example
{
"defaultConnectTimeoutSeconds": 15,
"defaultStreamTimeoutSeconds": 300,
"defaultRetryCount": 2,
"maxAiRequestBodyBytes": 20971520,
"maxAiBinaryRequestBodyBytes": 52428800,
"maxAiBinaryResponseBodyBytes": 52428800,
"maxToolTurns": 8,
"defaultConnectionPoolSize": 64,
"defaultIdleConnectionTimeoutSeconds": 4
}
Request Body Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| defaultConnectTimeoutSeconds | integer | No | 10 | Connect timeout to the LLM provider, in seconds. Must be between 1 and 300. |
| defaultStreamTimeoutSeconds | integer | No | 120 | Overall SSE stream timeout, in seconds. Must be between 1 and 3600. |
| defaultRetryCount | integer | No | 0 | Retry attempts on provider error. Must be between 0 and 10. |
| maxAiRequestBodyBytes | integer | No | 10485760 | Max JSON AI request body size in bytes. Must be between 1 and 1073741824 (1 GB). |
| maxAiBinaryRequestBodyBytes | integer | No | 26214400 | Max binary/multipart AI request body size in bytes. Must be between 1 and 1073741824 (1 GB). |
| maxAiBinaryResponseBodyBytes | integer | No | 26214400 | Max binary AI response body size in bytes. Must be between 1 and 1073741824 (1 GB). |
| maxToolTurns | integer | No | 5 | Ceiling on chained agentic tool-call turns. Must not exceed 100; a value <= 0 disables the loop (passthrough). |
| defaultConnectionPoolSize | integer | No | 64 | Idle connections kept open for reuse for each LLM provider of an AI proxy whose connection pool type is GENERAL. Must be between 1 and 1000. It limits idle connections only, not concurrent requests. |
| defaultIdleConnectionTimeoutSeconds | integer | No | 4 | Seconds an idle connection is kept for reuse (GENERAL pool). Must be between 1 and 3600. Keep it below the provider's own idle timeout (vLLM and other uvicorn servers close idle connections after 5 seconds). |
Notes
- The request body must not be empty
- Only non-null top-level fields are applied; all others are preserved
- Field bounds are enforced identically to the manager UI settings screen (backward-compat invariant)
- The default budget fields (
defaultBudget,defaultAnonymousBudget) were removed in version 2026.10.0. A request that still carries them is accepted; the fields are ignored and the rest is applied. Set AI limits with Limit Plans and the Token Rate Limit policy.
Response
Success Response (200 OK)
Returns the full settings document after the update (same shape as the read endpoint), with effective values.
{
"status": "SUCCESS",
"resultList": [
{
"defaultConnectTimeoutSeconds": 15,
"defaultStreamTimeoutSeconds": 300,
"defaultRetryCount": 2,
"maxAiRequestBodyBytes": 20971520,
"maxAiBinaryRequestBodyBytes": 52428800,
"maxAiBinaryResponseBodyBytes": 52428800,
"maxToolTurns": 8,
"defaultConnectionPoolSize": 64,
"defaultIdleConnectionTimeoutSeconds": 4
}
],
"resultCount": 1
}
Response Fields
| Field | Type | Description |
|---|---|---|
| status | string | Response status: SUCCESS or FAILURE |
| resultList | array | List containing the single updated settings object |
| resultCount | integer | Always 1 for this singleton resource |
Error Response (400 Bad Request)
Returned on validation failure, an empty body, or when the caller lacks the ADMIN role.
{
"status": "FAILURE",
"resultMessage": "defaultConnectTimeoutSeconds must be between 1 and 300!"
}
Other possible messages:
{
"status": "FAILURE",
"resultMessage": "Request body can not be empty!"
}
{
"status": "FAILURE",
"resultMessage": "defaultConnectionPoolSize must be between 1 and 1000!"
}
{
"status": "FAILURE",
"resultMessage": "defaultIdleConnectionTimeoutSeconds must be between 1 and 3600!"
}
{
"status": "FAILURE",
"resultMessage": "maxToolTurns must not exceed 100!"
}
{
"status": "FAILURE",
"resultMessage": "Unauthorized! Only users with ADMIN role can access this resource!"
}
Error Response (401 Unauthorized)
{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}
cURL Example
curl -X PUT \
"https://demo.apinizer.com/apiops/settings/ai-gateway" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"defaultConnectTimeoutSeconds": 15,
"defaultStreamTimeoutSeconds": 300,
"defaultRetryCount": 2,
"maxToolTurns": 8
}'
Notes and Warnings
- No license gate: This endpoint does not check the
AI_GATEWAYlicense module. The API layer of Apinizer applies no module gate at all, so an installation whose license does not name AI Gateway can read and write the global AI Gateway settings through it. System-admin authority remains the only gate. The AI Gateway screens in the Manager UI remain hidden without the module. - Admin Only:
- Only sysAdmin users (or users with the
ADMINrole) can update AI Gateway settings - A project-scoped
AI_DEVELOPMENTtoken is not sufficient
- Only sysAdmin users (or users with the
- Partial Update:
- Only non-null top-level fields are applied; omitted fields keep their stored value
- To leave a field unchanged, simply omit it from the body
- Validation Bounds:
- Bounds mirror the manager UI settings screen so both entry points enforce the same limits
maxToolTurns <= 0is a valid signal that disables the agentic tool-call loop
- Connection Pool Defaults:
defaultConnectionPoolSizeanddefaultIdleConnectionTimeoutSecondsapply to AI proxies whose connection pool type isGENERAL- A change reaches a gateway with the next deploy of each AI proxy
- Singleton:
- A single document governs the entire platform; if none exists it is created on first update
- No Secret Fields:
- This settings document carries no secret (
@SecretData) fields, so nothing is masked
- This settings document carries no secret (
Related Documentation
- Get AI Gateway Settings - Read these settings
- AI Gateway Settings API - Resource overview
- Error Handling - Error response formats