Skip to content

server: add include_params to GET /v1/models, read from the model spec - #787

Merged
0xShug0 merged 2 commits into
0xShug0:mainfrom
Navier8:server-models-include-params
Oct 4, 2026
Merged

0xShug0 merged 2 commits into
0xShug0:mainfrom
Navier8:server-models-include-params

Conversation

@Navier8

@Navier8 Navier8 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Update: pairs with #786, which documents OmniVoice, Qwen3-TTS and Qwen3-ASR options without moving those specs to schema_version: 1. A second commit makes include_params read options.request from the resolved spec whatever its version, so with #786 those models report their options. Tested on a Windows CPU build of #786 + this PR, serial and --parallel-jobs: OmniVoice returns 19 rows identical to #786's spec (plus the expanded preset values), Qwen3-ASR 7, Moonshine 3; transcription unchanged.

Closes #775. As discussed there, this adds only include_params and reads it from the model specs, not webui/configs/model_params.json.

What it does

GET /v1/models?include_params=true (or =1) adds params to each model entry. params holds the options.request rows from the model's schema-v1 spec, exactly as the spec writes them: name, type, required, description, and default/min/max where given.

  • An enum row that names a preset also gets the preset's values, so a client needs no copy of the preset table. Rows that already list values pass through unchanged.
  • A model whose spec declares no request options gets "params": []. Older-format specs are read too; since they skip the typed validator, rows that aren't objects are skipped, and a preset is expanded only when the framework knows it.
  • Without the flag, or with =false, the response is byte-for-byte what it was.

The spec is resolved the same way model_accepts_request_option resolves it: a per-model or server model_spec_override first, then the GGUF's embedded spec, then the installed model_specs/. Only the same missing or legacy contract errors are caught. Nothing depends on the WebUI being built.

The array is computed once in refresh_model_option_flags, next to the accepts_* flags. It's computed there for the reason given in their comment: reading the embedded spec on the request thread is slow. On the parallel runtime it's carried across a reconfigure in the same way as the flags. Both runtime.cpp and parallel_runtime.cpp get the same change, and app/server/README.md documents the flag.

Runtime validation

Setup. Windows 11, CPU release build (scripts/build_windows.ps1 -Preset windows-cpu-release -Target audiocpp_server, then again with -NativeModelManager for the reload test). The server was started with --config and four models registered:

id family spec params
omnivoice omnivoice legacy (embedded and installed) []
asr qwen3_asr legacy (embedded and installed) []
moonshine moonshine_asr v1, embedded in moonshine-streaming-tiny-q8_0.gguf 3 rows
moonshine-override moonshine_asr v1 via model_spec_override: a copy of the spec with one added text_chunk_mode row using "preset": "text_chunk_mode_full", to exercise preset expansion 4 rows

Checks, run on both the serial runtime and --parallel-jobs 2:

  • include_params absent or false: no params key on any entry.
  • include_params=true and =1: the moonshine rows are identical to model_specs/moonshine_asr.json options.request, compared as parsed JSON. audio_chunk_mode keeps its own values. moonshine-override matches its spec plus "values": ["word_budget","tag_aware","japanese","endline"] on the preset row.
  • include_params=1&include_session_options=true: both fields present.
  • The serial and parallel runtimes return identical params.
  • Reconfigure: with --ui-management, POST /v1/models/load on moonshine with the override spec moved its params from 3 rows to 4 ("reconfigured": true) on both runtimes.
  • No regression: /v1/audio/transcriptions on moonshine and asr returned "The quick brown fox jumps over the lazy dog." before and after, on both runtimes.
GET /v1/models?include_params=true
{"object":"list","data":[
  {"id":"omnivoice",...,"params":[]},
  {"id":"asr",...,"params":[]},
  {"id":"moonshine",...,"params":[
    {"name":"max_tokens","type":"int","description":"...","required":false,"min":0,"default":0},
    {"name":"audio_chunk_mode","type":"enum","description":"...","values":["auto","fixed","vad","none"],"required":false,"default":"auto"},
    {"name":"audio_chunk_duration_sec","type":"float","description":"...","required":false,"min":0.02,"default":60}]},
  ...]}

Not tested: CUDA, Vulkan or Metal builds. The change touches no backend code. A deployment build (AUDIOCPP_DEPLOYMENT_BUILD) wasn't tested either; it resolves specs through the same find_contract_spec_path. I haven't added a unit test because the existing server fixtures don't register a model with a spec. I'm happy to add one if you'd like it and can point me at the fixture you'd prefer.

Follow-up

#786 adds the options for OmniVoice and the Qwen3 families, which is what I needed. The OmniVoice spec PR I opened (#789) is closed in its favour.

🤖 Generated with Claude Code

GET /v1/models?include_params=true adds a "params" array to each entry:
the options.request rows the model's schema-v1 spec declares, passed
through as written. An enum row that names a preset also carries the
preset's values, so a client needs no copy of the preset table. A model
whose spec is not yet on schema_version 1 returns "params": [].

The spec is resolved the way model_accepts_request_option resolves it:
per-model or server spec override first, then the GGUF's embedded spec,
then the installed model_specs/. It works without the WebUI built.

The array is computed once at registration in refresh_model_option_flags,
beside the accepts_* flags and for the same reason: the embedded-spec
read is too slow for the request thread. The parallel runtime carries it
across a reconfigure like the flags. The flag is opt-in, so existing
responses are unchanged.

Refs 0xShug0#775

Co-Authored-By: Claude Opus 5.5 <[email protected]>
0xShug0#786 documents OmniVoice, Qwen3-TTS and Qwen3-ASR options in their specs
without moving them to schema_version 1, and include_params returned []
for them because it required a v1 spec. Read options.request from the
resolved spec whatever its version. Older-format specs skip the typed
validator, so rows that are not objects are left out, and a preset is
expanded only when the framework knows it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@0xShug0
0xShug0 merged commit ad9bc82 into 0xShug0:main Oct 4, 2026
11 checks passed
@0xShug0

0xShug0 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

@Navier8 Thanks! PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server: expose each model's request parameters over HTTP (e.g. GET /v1/models?include_params=true)

2 participants