Ana içeriğe geç

Update AI Gateway Settings

Endpoint​

PUT /apiops/settings/ai-gateway

Authentication​

Requires a Personal API Access Token with admin privileges.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

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​

FieldTypeRequiredDefaultDescription
defaultConnectTimeoutSecondsintegerNo10Connect timeout to the LLM provider, in seconds. Must be between 1 and 300.
defaultStreamTimeoutSecondsintegerNo120Overall SSE stream timeout, in seconds. Must be between 1 and 3600.
defaultRetryCountintegerNo0Retry attempts on provider error. Must be between 0 and 10.
maxAiRequestBodyBytesintegerNo10485760Max JSON AI request body size in bytes. Must be between 1 and 1073741824 (1 GB).
maxAiBinaryRequestBodyBytesintegerNo26214400Max binary/multipart AI request body size in bytes. Must be between 1 and 1073741824 (1 GB).
maxAiBinaryResponseBodyBytesintegerNo26214400Max binary AI response body size in bytes. Must be between 1 and 1073741824 (1 GB).
maxToolTurnsintegerNo5Ceiling on chained agentic tool-call turns. Must not exceed 100; a value <= 0 disables the loop (passthrough).
defaultConnectionPoolSizeintegerNo64Idle 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.
defaultIdleConnectionTimeoutSecondsintegerNo4Seconds 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​

FieldTypeDescription
statusstringResponse status: SUCCESS or FAILURE
resultListarrayList containing the single updated settings object
resultCountintegerAlways 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_GATEWAY license 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 ADMIN role) can update AI Gateway settings
    • A project-scoped AI_DEVELOPMENT token is not sufficient
  • 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 <= 0 is a valid signal that disables the agentic tool-call loop
  • Connection Pool Defaults:
    • defaultConnectionPoolSize and defaultIdleConnectionTimeoutSeconds apply to AI proxies whose connection pool type is GENERAL
    • 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