Commit 41a4d59
authored
feat: openrouter_slug override for OpenRouter provider listing (#740)
* feat: openrouter_slug override for OpenRouter provider listing
OpenRouter's provider spec requires the model `id` in GET /v1/models to
exactly match OpenRouter's canonical slug, or for the provider to supply an
explicit override. 8 of our 9 listed models do not match OR's slug.
Add an admin-settable per-model `openrouter_slug` field that surfaces on the
public GET /v1/models as a nested `openrouter: { slug }` object, emitted only
when set (omitted entirely when NULL). Mirrors the datacenters/is_ready/
deprecation_date precedent end-to-end:
- migration V0056: nullable `openrouter_slug TEXT` on models + model_history
- Model / ModelHistory / service structs + repository read/write round-trip
- UpdateModelApiRequest: `openrouterSlug` (camelCase), tri-state Nullable so
JSON null clears it; omitted leaves it unchanged
- admin write-path validation: rejects non lowercase `author/slug` shape (400)
- public serializer model_with_pricing_to_info emits the nested object
- unit tests (slug validator + serializer emit/omit) and e2e tests
(write+read round-trip, public nested object, clear via null, tri-state
omit guard, invalid-slug rejection)
Post-merge admin backfill is a separate prod write step (see PR body).
* fix(db): renumber openrouter_slug migration V0056->V0057 (avoid collision with #737)1 parent 4cefef7 commit 41a4d59
12 files changed
Lines changed: 466 additions & 23 deletions
File tree
- crates
- api
- src
- routes
- tests/e2e_all
- database/src
- migrations/sql
- repositories
- services/src
- admin
- models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
840 | 858 | | |
841 | 859 | | |
842 | 860 | | |
| |||
3047 | 3065 | | |
3048 | 3066 | | |
3049 | 3067 | | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
3050 | 3073 | | |
3051 | 3074 | | |
3052 | 3075 | | |
| |||
3151 | 3174 | | |
3152 | 3175 | | |
3153 | 3176 | | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
3154 | 3195 | | |
3155 | 3196 | | |
3156 | 3197 | | |
| |||
3332 | 3373 | | |
3333 | 3374 | | |
3334 | 3375 | | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
3335 | 3379 | | |
3336 | 3380 | | |
3337 | 3381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
93 | 124 | | |
94 | 125 | | |
95 | 126 | | |
| |||
301 | 332 | | |
302 | 333 | | |
303 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
304 | 353 | | |
305 | 354 | | |
306 | 355 | | |
| |||
353 | 402 | | |
354 | 403 | | |
355 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
356 | 409 | | |
357 | 410 | | |
358 | 411 | | |
| |||
562 | 615 | | |
563 | 616 | | |
564 | 617 | | |
| 618 | + | |
565 | 619 | | |
566 | 620 | | |
567 | 621 | | |
| |||
668 | 722 | | |
669 | 723 | | |
670 | 724 | | |
| 725 | + | |
671 | 726 | | |
672 | 727 | | |
673 | 728 | | |
| |||
806 | 861 | | |
807 | 862 | | |
808 | 863 | | |
| 864 | + | |
809 | 865 | | |
810 | 866 | | |
811 | 867 | | |
| |||
1313 | 1369 | | |
1314 | 1370 | | |
1315 | 1371 | | |
| 1372 | + | |
1316 | 1373 | | |
1317 | 1374 | | |
1318 | 1375 | | |
| |||
3143 | 3200 | | |
3144 | 3201 | | |
3145 | 3202 | | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2288 | 2288 | | |
2289 | 2289 | | |
2290 | 2290 | | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
2291 | 2298 | | |
2292 | 2299 | | |
2293 | 2300 | | |
| |||
2376 | 2383 | | |
2377 | 2384 | | |
2378 | 2385 | | |
| 2386 | + | |
2379 | 2387 | | |
2380 | 2388 | | |
2381 | 2389 | | |
| |||
2420 | 2428 | | |
2421 | 2429 | | |
2422 | 2430 | | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
2423 | 2469 | | |
2424 | 2470 | | |
2425 | 2471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| 278 | + | |
277 | 279 | | |
278 | 280 | | |
279 | 281 | | |
| |||
0 commit comments