## Problem When using a custom-type provider (e.g. ZenMux) with `zenmux/auto` model routing, the `model_routing_config` parameter is required in the `/chat/completions` request body, but Alma's `providerOptions` mechanism does not transparently pass custom parameters to the API request. After setting `providerOptions` on a model via the API (`PUT /api/providers/:id`), the parameters never reach the actual HTTP request sent to the provider. ## Root Cause (from reverse-engineering `app.asar`) In the main process, for `custom` type providers, Alma correctly maps `providerOptions` into the AI SDK's metadata: ```js // Custom β OpenAI mapping const o = "custom" === n ? "openai" : n; Et[o] = { ...Et[o] || {}, ...e }; // e = model's providerOptions ``` However, the `@ai-sdk/openai-compatible` SDK's `getArgs` filters providerOptions through its schema: ```js Object.fromEntries( Object.entries(providerOptions?.[this.providerOptionsName] ?? {}) .filter(([key]) => !Object.keys(schema).includes(key)) ) ``` This suggests the parameters **should** pass through (unknown keys are kept), but in practice they don't reach the request body. ## Use Case ZenMux's intelligent model routing requires `model_routing_config` in the request body: ```json { "model": "zenmux/auto", "model_routing_config": { "available_models": ["sapiens-ai/agnes-2.0-flash", "google/gemini-3.5-flash", "deepseek/deepseek-v4-pro", "openai/gpt-5.4"], "preference": "balanced" } } ``` Without this parameter, the API returns: `Parameter model_routing_config is required when model is zenmux/auto`. ## Suggested Solutions - **Option A (Fix)**: Ensure `providerOptions` set on a model are transparently spread into the chat completions request body for custom-type providers - **Option B (New feature)**: Add an `extraBody` or `bodyTemplate` field to `StoredProviderModel` that gets merged into the API request body, independent of the providerOptions mechanism - **Option C (Workaround)**: Allow setting fixed body parameters at the provider level that are always included in requests ## Environment - Alma version: v0.0.810 - Provider type: custom (ZenMux) - Model: zenmux/auto
Please authenticate to join the conversation.
In Review
Feature Request
About 20 hours ago

hh0592821
Get notified by email when there are changes.
In Review
Feature Request
About 20 hours ago

hh0592821
Get notified by email when there are changes.