# Update LLM gateway settings in project

`PATCH /v1/projects/{project}/settings/llmGateway`, operation `llmGatewaySettings.UpdateLlmGatewaySettingsInProject`

Changes the LLM gateway's settings of an organization or a project.

The body is a JSON merge patch (RFC 7396), sent as application/merge-patch+json: a setting left out keeps its value, null unsets it, so that it takes what the level above makes apply, and a value replaces it, a list's whole. With If-Match, the update fails with failed_precondition, as 412, if the settings changed since it was read.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | Yes | `string` | The project's ID. |
| `If-Match` | header | No | `string` | The ETag of the settings as they were read: the update fails with failed_precondition, as 412, if they changed since. |

## Request body

Content-Type: `application/merge-patch+json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `monthlySpendLimit` | `Money \| null` | No | The most that requests here may cost in a calendar month (UTC), in US dollars, from $0 to $1,000,000,000, or null for no limit. |

## Responses

### 200

OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `effective` | `EffectiveLlmGatewaySettings` | Yes | What applies to requests here, and where each setting's value comes from. |
| `effective.monthlySpendLimit` | `EffectiveMoney` | No | The lower of the organization's monthly spend limit, which counts the spend of all of its projects, and the project's, which counts its own: the most that requests here may cost in a month. Absent where neither sets one, which is kosem's default of no limit. Each limit refuses requests once the spend it counts reaches it. |
| `inherited` | `EffectiveLlmGatewaySettings` | Yes | What the level above makes apply, which a setting unset here takes: for a project, its organization's effective settings; for an organization, kosem's defaults. |
| `inherited.monthlySpendLimit` | `EffectiveMoney` | No | The lower of the organization's monthly spend limit, which counts the spend of all of its projects, and the project's, which counts its own: the most that requests here may cost in a month. Absent where neither sets one, which is kosem's default of no limit. Each limit refuses requests once the spend it counts reaches it. |
| `monthlySpendLimit` | `Money` | No | The most that requests here may cost in a calendar month (UTC), in US dollars; absent while unset, which is no limit. An organization's limit counts all of its projects, and a project's only itself. Once a limit is reached, the gateway refuses requests until the month ends; requests already running may go a little past it. Only models whose prices kosem knows count. |
| `monthlySpendLimit.currencyCode` | `string` | Yes | The currency, as its three-letter ISO 4217 code, such as USD. |
| `monthlySpendLimit.nanos` | `integer (int32)` | Yes | The billionths of a unit of the amount, such as 500000000 of US$1.50. |
| `monthlySpendLimit.units` | `integer (int64)` | Yes | The whole units of the amount, such as 1 of US$1.50. |
| `name` | `string` | Yes | Resource name, organizations/{organization_id}/settings/llmGateway or projects/{project_id}/settings/llmGateway. |
| `updateTime` | `string (date-time)` | No | When the settings set here last changed; absent if they never did. |

### default

Error

Base URL: `https://api.kosem.ai`. See [API conventions](https://docs.kosem.ai/reference/api-conventions.md) for authentication, pagination and errors, and [https://docs.kosem.ai/openapi.yaml](https://docs.kosem.ai/openapi.yaml) for the full OpenAPI document.