From f17d156ef51d8b26e3abe3aaa0b42502e10b6b89 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:05:01 +0000 Subject: [PATCH] fix: make the upsert 1h price key optional The endpoint and the CLI treat a missing cache_write_1h_price like null, and tiers is already omitempty. Without omitempty the generated AIModelPriceUpsert type required the key, so a TypeScript client that built the four-price upsert stopped compiling. --- codersdk/aimodelprices.go | 6 +++--- site/src/api/typesGenerated.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/codersdk/aimodelprices.go b/codersdk/aimodelprices.go index bbf0eabe33..7cfdb4da16 100644 --- a/codersdk/aimodelprices.go +++ b/codersdk/aimodelprices.go @@ -77,8 +77,8 @@ type UpsertAIModelPricesRequest struct { } // AIModelPriceUpsert is one model's prices in an upsert request. It carries -// only the writable fields of AIModelPrice. A null CacheWrite1hPrice, or a -// missing or null Tiers, clears it. +// only the writable fields of AIModelPrice. A missing or null +// CacheWrite1hPrice or Tiers clears it. type AIModelPriceUpsert struct { Provider string `json:"provider"` Model string `json:"model"` @@ -86,7 +86,7 @@ type AIModelPriceUpsert struct { OutputPrice *int64 `json:"output_price"` CacheReadPrice *int64 `json:"cache_read_price"` CacheWritePrice *int64 `json:"cache_write_price"` - CacheWrite1hPrice *int64 `json:"cache_write_1h_price"` + CacheWrite1hPrice *int64 `json:"cache_write_1h_price,omitempty"` Tiers []AIModelPriceTier `json:"tiers,omitempty"` } diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index b609d7369e..260a396f47 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -415,8 +415,8 @@ export interface AIModelPriceTier { // From codersdk/aimodelprices.go /** * AIModelPriceUpsert is one model's prices in an upsert request. It carries - * only the writable fields of AIModelPrice. A null CacheWrite1hPrice, or a - * missing or null Tiers, clears it. + * only the writable fields of AIModelPrice. A missing or null + * CacheWrite1hPrice or Tiers clears it. */ export interface AIModelPriceUpsert { readonly provider: string; @@ -425,7 +425,7 @@ export interface AIModelPriceUpsert { readonly output_price: number | null; readonly cache_read_price: number | null; readonly cache_write_price: number | null; - readonly cache_write_1h_price: number | null; + readonly cache_write_1h_price?: number; readonly tiers?: readonly AIModelPriceTier[]; }