API7 Docs
API7 GatewayAPI7 Enterprise Admin APIsUpdate an AI model

Update an AI model

PUT /aisix/admin/models/{model_id}

PUT /aisix/admin/models/{model_id}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

model_id*string

AI Model ID.

Length1 <= length

Query Parameters

ai_gateway_group_id*string

AI Gateway group ID (filter resources by group).

Length1 <= length

Request Body

application/json

Response Body

application/json

application/json

application/json

curl -X PUT "$API_BASE_URL/aisix/admin/models/model-abc123?ai_gateway_group_id=abc1234567890" \  -H "Content-Type: application/json" \  -d '{    "name": "my-gpt4o",    "model": "gpt-4o",    "provider_id": "provider-abc123"  }'

Successfully retrieved or modified the AI model.

{
  "value": {
    "id": "model-abc123",
    "ai_gateway_group_id": "group-abc123",
    "name": "openai/gpt-4o-alias",
    "model": "gpt-4o",
    "provider_id": "provider-abc123",
    "timeout": 30000,
    "rate_limit": {
      "tpm": 1,
      "tpd": 1,
      "rpm": 1,
      "rpd": 1,
      "concurrency": 1
    },
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
}
Complete operation details and schema variants

PUT /aisix/admin/models/{model_id}

Update an AI model

IAM Action: ai_gateway:UpdateAIModel, Resource: arn:api7:ai_gateway:aigatewaygroup/%s Updates the specified AI model configuration. Changes are synced to the aisix data plane via etcd.

Parameters

  • ai_gateway_group_id (query, string, required): AI Gateway group ID (filter resources by group).
  • model_id (path, string, required): AI Model ID.

Request body

Content type: application/json

  • name (string, required): Human-readable name for the model. Used as the model identifier in aisix proxy requests.
  • model (string, required): Underlying model identifier used by the provider.
  • provider_id (string, required): ID of the AIProvider that supplies credentials for this model. The provider must belong to the same AI Gateway group.
  • timeout (integer, optional): Request timeout in milliseconds.
  • rate_limit (object, optional): Rate limit configuration for AI requests. Field names use the abbreviated forms that match aisix's internal representation (tpm/tpd/rpm/rpd/concurrency).
  • rate_limit.tpm (integer, optional): Maximum tokens allowed per minute (token_per_minute).
  • rate_limit.tpd (integer, optional): Maximum tokens allowed per day (token_per_day).
  • rate_limit.rpm (integer, optional): Maximum requests allowed per minute (request_per_minute).
  • rate_limit.rpd (integer, optional): Maximum requests allowed per day (request_per_day).
  • rate_limit.concurrency (integer, optional): Maximum concurrent requests allowed.

Responses

  • 200: Successfully retrieved or modified the AI model.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional): LLM model configuration in an AI Gateway group.
  • value.id (string, optional): Unique model ID.
  • value.ai_gateway_group_id (string, optional): ID of the AI Gateway group this model belongs to (control-plane only).
  • value.name (string, optional): Human-readable name for the model. Used as the model identifier in aisix proxy requests.
  • value.model (string, optional): Underlying model identifier used by the provider.
  • value.provider_id (string, optional): ID of the AIProvider entry that supplies credentials for this model. The provider must belong to the same AI Gateway group.
  • value.timeout (integer, optional): Request timeout in milliseconds.
  • value.rate_limit (object, optional): Rate limit configuration for AI requests. Field names use the abbreviated forms that match aisix's internal representation (tpm/tpd/rpm/rpd/concurrency).
  • value.rate_limit.tpm (integer, optional): Maximum tokens allowed per minute (token_per_minute).
  • value.rate_limit.tpd (integer, optional): Maximum tokens allowed per day (token_per_day).
  • value.rate_limit.rpm (integer, optional): Maximum requests allowed per minute (request_per_minute).
  • value.rate_limit.rpd (integer, optional): Maximum requests allowed per day (request_per_day).
  • value.rate_limit.concurrency (integer, optional): Maximum concurrent requests allowed.
  • value.created_at (string, optional): Timestamp when the model was created.
  • value.updated_at (string, optional): Timestamp when the model was last updated.
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.
  • 404: Not Found — The requested resource does not exist or has been deleted. Response fields (application/json): identical to PUT /aisix/admin/models/{model_id}, response 400 above.

cURL

curl -X PUT '$API_BASE_URL/aisix/admin/models/{model_id}'