Skip to content

Commit 989140d

Browse files
authored
feat: add extraBody support to model aliases (#437)
## Summary Adds `extraBody` (extra body fields) support to model aliases, matching the existing functionality at the provider and provider-model levels. This allows injecting extra fields into request bodies for all requests routed through a given alias. ### Merge priority Provider-level `extraBody` → Model-level `extraBody` → **Alias-level `extraBody`** (highest priority, overrides both) ## Changes ### Backend - **Schema**: Add `extra_body` column to `model_aliases` table (SQLite: `text`, Postgres: `jsonb`) - **Config**: Add `extraBody: z.record(z.string(), z.any()).optional()` to `ModelConfigSchema` - **Config Repository**: Read/write `extraBody` in `rowToModelConfig` and `saveAlias` - **Dispatcher**: Merge alias-level `extraBody` in all 4 dispatch paths (chat, embeddings, speech, image generation) - **Tests**: Update test to handle pending migration column ### Frontend - **API**: Add `extraBody` to `Alias` interface, `saveAlias`, and `getAliases` - **UI**: Add `AliasExtraBodyEditor` component (key-value pair editor) inside the Advanced disclosure in the alias edit modal ### Migrations - SQLite: `ALTER TABLE model_aliases ADD extra_body text` - Postgres: `ALTER TABLE model_aliases ADD COLUMN extra_body jsonb` ## Test plan - [x] All 1320 backend tests pass - [x] Frontend builds and typechecks cleanly - [x] Pre-commit hooks pass (tests, lint, format, typecheck, frontend build) - [ ] Manual: create alias with extraBody fields, verify they appear in dispatched request payloads - [ ] Manual: verify alias-level extraBody overrides provider/model-level with same keys
2 parents dc09068 + 82fb294 commit 989140d

15 files changed

Lines changed: 6383 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `model_aliases` ADD `extra_body` text;

0 commit comments

Comments
 (0)