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.
This commit is contained in:
Michael Suchacz
2026-10-15 20:05:01 +00:00
parent e299124e40
commit f17d156ef5
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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"`
}
+3 -3
View File
@@ -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[];
}