---
title: "PATCH /ai/providers/{id}"
method: PATCH
path: "/ai/providers/{id}"
tags: ["AI Gateway Admin"]
---

# PATCH /ai/providers/{id}

`PATCH /ai/providers/{id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/ai/providers/{id}`
- Auth: HTTP bearer

## Path parameters

- `id` integer, required

## Request body

- UpdateProviderKeyRequest
  - `api_key` string, password, nullable: A credential. Write-only: it is never returned, and the AI assistant supplies it through a secret slot instead of typing it into the conversation.
  - `base_url` string, nullable: Double-Option: absent = leave unchanged, present-null = clear (revert to the provider's default endpoint), present-value = set. Moving the base URL to another address drops the per-key private-address trust.
  - `capabilities` SelfHostedCapabilities, nullable: Capabilities an administrator declared for a self-hosted key. Requests needing an undeclared capability are refused before anything is sent.
    - `embeddings` boolean: The `/embeddings` endpoint.
    - `responses_api` boolean: The OpenAI Responses API (`/responses`).
    - `streaming` boolean: Streaming chat completions (`"stream": true`). Required by AI chat.
    - `tools` boolean: Function/tool calling in chat completions.
  - `default_model` string, nullable: Double-Option: absent = leave unchanged, present-null = clear the pinned model (revert to the per-provider default), present-value = set.
  - `display_name` string, nullable
  - `is_active` boolean, nullable
  - `trust_private_address` boolean, nullable: `true` trusts the exact private `ip:port` of the (new) base URL for this key only (requires `settings:write`); `false` removes the trust.

## Response `200`

Provider key updated

- ProviderKeyResponse
  - `api_key_masked` string, required: Masked API key (only last 4 chars visible)
  - `base_url` string, nullable
  - `capabilities` SelfHostedCapabilities, nullable: Capabilities an administrator declared for a self-hosted key. Requests needing an undeclared capability are refused before anything is sent.
    - `embeddings` boolean: The `/embeddings` endpoint.
    - `responses_api` boolean: The OpenAI Responses API (`/responses`).
    - `streaming` boolean: Streaming chat completions (`"stream": true`). Required by AI chat.
    - `tools` boolean: Function/tool calling in chat completions.
  - `created_at` string, required
  - `default_model` string, nullable: Model id this provider serves (NULL → per-provider default).
  - `display_name` string, required
  - `id` integer, required
  - `is_active` boolean, required
  - `provider` string, required
  - `trusted_private_address` string, nullable: Exact private `ip:port` this key may reach without that address being in the instance-wide trusted private networks. `None` when not set.
  - `trusted_private_address_set_at` string, nullable: When the per-key trust was set (ISO 8601).
  - `trusted_private_address_set_by` integer, nullable: User who set the per-key trust.
  - `updated_at` string, required

## Other responses

- `400`: Validation error, or a new API key that failed verification (the current key is kept)
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Not found

## Changes

- **2026-11-09** `12896146b193`: 4 breaking
  - removed the required property `extensions` from the response with the `400` status
  - removed the required property `extensions` from the response with the `401` status
  - removed the required property `extensions` from the response with the `403` status
  - removed the required property `extensions` from the response with the `404` status
- **2026-10-23** `7d41b820a372`: 2 breaking, 1 info
  - the request property `api_key` became not nullable
  - the `api_key` request property type changed from `string, null` to no type
  - added `#/components/schemas/SecretString, subschema #2` to the `api_key` request property `oneOf` list
- **2026-10-23** `24af93ff5379`: 2 breaking, 1 info
  - removed `#/components/schemas/SecretString, subschema #2` from the `api_key` request property `oneOf` list
  - the `api_key` request property type changed from no type to `string, null`
  - the request property `api_key` became nullable
- **2026-10-22** `842d42ed4659`: 2 breaking, 1 info
  - the request property `api_key` became not nullable
  - the `api_key` request property type changed from `string, null` to no type
  - added `#/components/schemas/SecretString, subschema #2` to the `api_key` request property `oneOf` list
- …earlier changes not shown

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/ai/providers/:id/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
