Commit affc50e
authored
feat(kilo-auto-model): add input_cache_read and input_cache_write prices (#1638)
## Summary
Adds `input_cache_read_price` and `input_cache_write_price` fields to
the `AutoModel` type and populates them for all four Kilo Auto models.
Prices are sourced from OpenRouter (`/api/v1/models`) using the most
expensive constituent model in each tier:
- **Frontier** (`anthropic/claude-opus-4.6`): cache_read `0.0000005`,
cache_write `0.00000625`
- **Balanced** (`moonshotai/kimi-k2.5`): cache_read `0.000000225`,
cache_write undefined (not offered)
- **Small** (`openai/gpt-5-nano`): cache_read `0.000000005`, cache_write
undefined (not offered)
- **Free**: cache_read `0`, cache_write `0`
The `buildAutoModels()` function in `openrouter/index.ts` is updated to
pass `input_cache_read` and `input_cache_write` through to the `pricing`
object in the model response, which already supports these optional
fields via the Zod schema in `organization-types.ts`.
## Verification
- Reviewed OpenRouter API response for all constituent model IDs to
confirm prices
- Verified `OpenRouterModel.pricing` Zod schema accepts `string |
undefined` for both cache fields
- Confirmed field names match the existing `input_cache_read` /
`input_cache_write` convention used elsewhere in the codebase
## Visual Changes
N/A
## Reviewer Notes
Cache write prices are `undefined` for Balanced and Small because those
constituent models (`kimi-k2.5`, `gpt-5-nano`) do not offer a cache
write price on OpenRouter. The Frontier model uses Claude Opus 4.6
pricing since it is the most expensive model routed to in that tier.File tree
3 files changed
+18
-0
lines changed- src
- lib
- providers/openrouter
- tests
3 files changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| 135 | + | |
| 136 | + | |
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
| |||
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| 153 | + | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
| |||
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| 171 | + | |
| 172 | + | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
| |||
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| 189 | + | |
| 190 | + | |
181 | 191 | | |
182 | 192 | | |
183 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
710 | 715 | | |
711 | 716 | | |
712 | 717 | | |
| 718 | + | |
713 | 719 | | |
714 | 720 | | |
715 | 721 | | |
| |||
0 commit comments