---
title: "Update provider-scoped settings without touching the saved credential. Today that means just `default_model`; future per-provider settings (base URL overrides, request headers, etc.) can land here too without changing the shape of `save_credential`."
method: PATCH
path: "/settings/ai-providers/{provider_id}"
tags: ["Agents"]
---

# Update provider-scoped settings without touching the saved credential. Today that means just \`default_model\`; future per-provider settings (base URL overrides, request headers, etc.) can land here too without changing the shape of \`save_credential\`.

`PATCH /settings/ai-providers/{provider_id}`

## Request

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

## Path parameters

- `provider_id` string, required

## Request body

- UpdateAiProviderRequest: Body for `PATCH /settings/ai-providers/{provider_id}` — updates provider-scoped settings (just the default model for now) without touching the credential. Keeping credentials out of this shape means the UI can auto-save model changes on select, without forcing the user to re-paste their token or config file. Name-spaced schema name avoids an OpenAPI collision with `temps-notifications::UpdateProviderRequest`, which has different fields. Both are exposed as `utoipa::ToSchema`; without the override the merged OpenAPI doc would silently shadow one struct with the other and break generated CLI/web clients.
  - `default_model` string, nullable: New default model id. `None` or an empty string clears the stored value so the CLI falls back to its own default.
  - `max_turns_analysis` integer, nullable: Default max turns for the autofixer analysis phase (1–200). `0` clears the stored value (built-in default applies); omitted/`None` leaves the current value unchanged — so a PATCH that only updates `default_model` doesn't wipe the turn settings.
  - `max_turns_feedback` integer, nullable: Default max turns for autofixer feedback rounds (1–200). `0` clears; omitted leaves unchanged.
  - `max_turns_fix` integer, nullable: Default max turns for the autofixer fix phase (1–200). `0` clears; omitted leaves unchanged.

## Response `200`

- UpdateAiProviderResponse
  - `default_model` string, nullable
  - `max_turns_analysis` integer, nullable
  - `max_turns_feedback` integer, nullable
  - `max_turns_fix` integer, nullable
  - `provider_id` string, required

## Other responses

- `400`: Unknown provider
- `401`: Unauthorized

## Changes

- **2026-07-27** `1b060c0a4ba3`: 6 info
  - added the new optional request property `max_turns_analysis`
  - added the new optional request property `max_turns_feedback`
  - added the new optional request property `max_turns_fix`
  - added the optional property `max_turns_analysis` to the response with the `200` status
  - …2 more
- **2026-04-25** `774be20905f2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/settings/ai-providers/:provider_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)
