How to Override Fusion Settings Per Request in FreeLLMAPI
Yes—FreeLLMAPI allows you to customize Fusion request-routing behavior on a per-call basis by including an optional fusion field in your JSON payload.
When you send requests to the virtual model ID fusion, you can inject request-level configuration that temporarily overrides your dashboard-wide defaults. This gives you granular control over panel size, model selection, judging criteria, and more—without affecting other API consumers or permanently changing your saved settings.
How Fusion Per-Request Overrides Work
FreeLLMAPI's Fusion service implements a layered configuration system. Your request-level fusion object merges with the saved defaults stored under the key fusion_config, with request properties taking precedence.
The merging logic lives in resolveEffectiveConfig() at server/src/services/fusion.ts (line 161). Here's the data flow:
- Request extraction: The proxy route at
server/src/routes/proxy.ts(line 579) pulls the inline config usingparsed.data.fusion ?? {} - Schema validation: The payload must conform to
fusionConfigSchemadefined atserver/src/services/fusion.ts(line 66) - Config merging: Request properties overwrite saved defaults; omitted properties inherit from the dashboard configuration
This architecture means you only specify what you want to change—everything else falls back to your baseline setup.
Override Options Available Per Request
Any field defined in FusionConfig can be supplied inline. The most commonly overridden properties include:
| Property | Purpose | Example Override |
|---|---|---|
k |
Panel size (number of models) | "k": 5 |
models |
Explicit list of models to use | ["openai/gpt-4o", "anthropic/claude-3"] |
judge |
Model that evaluates panel responses | { "platform": "openai", "model": "gpt-4o" } |
strategy |
Panel selection strategy ("auto", "manual", etc.) |
"strategy": "auto" |
disabled |
Models to exclude from this request | ["cohere/command-r-plus"] |
Code Examples
Override Panel Size Only
Send this to use a 4-model panel regardless of your default setting:
POST /v1/chat/completions HTTP/1.1
Content-Type: application/json
Authorization: Bearer <YOUR_API_KEY>
{
"model": "fusion",
"messages": [{ "role": "user", "content": "Explain quantum tunnelling." }],
"fusion": { "k": 4 }
}
The Fusion service runs your prompt on four models instead of your configured default size.
Custom Model List and Judge
Specify exactly which models participate and who evaluates their responses:
{
"model": "fusion",
"messages": [{ "role": "user", "content": "Write a Python script that scrapes a website." }],
"fusion": {
"models": ["openai/gpt-4o", "google/gemini-1.5-pro", "anthropic/claude-3-opus"],
"judge": { "platform": "openai", "model": "gpt-4o" },
"strategy": "auto"
}
}
The panel consists solely of your three specified models, with gpt-4o acting as judge using automatic selection strategy.
Temporarily Disable a Model
Exclude a specific model for a single request without modifying your global config:
{
"model": "fusion",
"messages": [{ "role": "user", "content": "Summarize the latest news about AI." }],
"fusion": {
"disabled": ["cohere/command-r-plus"]
}
}
The disabled model is omitted from this panel only—subsequent requests revert to your saved defaults.
Key Implementation Files
These source locations define how per-request Fusion settings are processed according to the FreeLLMAPI codebase:
server/src/services/fusion.ts—fusionConfigSchemaandFusionConfigtype definition (line 66)server/src/services/fusion.ts—resolveEffectiveConfig()merging logic (line 161)server/src/routes/proxy.ts— Request extraction:parsed.data.fusion ?? {}(line 579)server/src/routes/settings.ts— Dashboard default management endpoints (line 116)
Summary
- FreeLLMAPI supports per-request Fusion overrides via the optional
fusionfield in your JSON payload - Request properties merge with saved defaults—you only override what you specify
- The
fusionobject must validate againstfusionConfigSchemaas implemented inserver/src/services/fusion.ts - Common use cases include adjusting panel size, swapping models, changing judges, and temporary exclusions
- No dashboard changes required—overrides are ephemeral and scoped to individual requests
Frequently Asked Questions
What happens if I don't include a fusion field in my request?
The Fusion service uses your dashboard-wide defaults unchanged. The saved configuration stored under fusion_config applies to every request unless explicitly overridden at the request level.
Can I override Fusion settings per request without an API key?
No. Authentication via Authorization: Bearer <YOUR_API_KEY> is required for all Fusion requests, as enforced in the proxy routing layer. The override mechanism operates only on authenticated requests.
Do per-request overrides affect my saved dashboard configuration?
No. The merging logic in resolveEffectiveConfig() creates a temporary merged configuration for the current request only. Your persisted defaults remain intact and are managed separately through the settings endpoints at server/src/routes/settings.ts.
What validation errors occur with invalid Fusion overrides?
Requests with malformed fusion payloads fail schema validation against fusionConfigSchema. The proxy layer returns a validation error before the Fusion service processes the request, ensuring type safety and preventing partial configuration application.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →