[Feature]: close the OpenAI-API compatibility gap in `c/openai_server.py`, in value tiers
Problem
See the solution section below for problem/solution details. In short, unimplemented or stubbed-off elements of the OpenAI API represent opportunities to implement some useful functionality that harnesses and other built systems could easily access if implemented. Building these capabilities with the OpenAI API in mind improves consistency and compatibility - don't reinvent the wheel (unless we happen to know that particular wheel is bad).
Proposed solution
Authored by Claude Fable 5.1 in Claude Code, analysis in partnership with @Monotophic
Compatibility has three legitimate outcomes: a field is applied, documented as ignored, or
refused — never accepted in silence and answered with a result the client thinks it shaped.
openai_server.py has no unknown-field handling, so fifteen documented OpenAI request fields land
in that fourth case — for a harness-driven server, the failure mode worth prioritising.
Tier 1 — blocks a common client, or silently changes a result
| Field | What happens today | Fix shape |
|---|---|---|
logit_bias |
ignored; a closed answer set is silently unrestricted | refuse a non-empty map |
best_of |
ignored; one plain sample reported as best-of-k | refuse above 1 |
seed |
400 unsupported_parameter, even for seed: 0 |
wire+engine |
n > 1 |
400 unsupported_value |
server loop, or wire+engine |
prompt non-string |
400; the guard requires a string |
gateway plumbing, or batching |
Both refusals need the threshold shown: best_of: 1 is the default, an empty logit_bias a no-op.
Of the non-string prompt shapes, token ids are the sharp refusal: the intake exists on the wire.
Tier 2 — valuable, moderate work
| Field | What happens today | Fix shape |
|---|---|---|
reasoning_tokens |
folded into completion_tokens |
the engine must report a count |
cached_tokens |
absent; a hit percentage is reported | server-only if the engine counts |
tool_choice: "required" |
prompt-level on four of nine renderers | make the five consistent |
| penalties | 400 when non-zero |
engine-side sampler work |
response_format |
steers a verified draft, not the output | document first |
tool_choice: "required" is the sharpest: four renderers make it a "you MUST call a tool"
instruction, five ignore it, none constrains sampling. Grammar-forcing is no remedy — that path
feeds a draft that is then verified, so enforcement needs a sampling-side mechanism we lack.
Tier 3 — ignore, and say so; or refuse
Eleven fields ask for hosted-platform bookkeeping with no local referent: store, metadata,
service_tier, user, safety_identifier, parallel_tool_calls, prompt_cache_key, verbosity,
web_search_options, moderation, stream_options.include_obfuscation. They change no token, so
ignoring them is right; the defect is the silence, and one documented list closes all eleven.
Two fields earn a refusal instead, by the Tier-1 test: suffix has no infill path behind it,
and modalities: ["audio"] on a text-only checkpoint silently returns text.
What we would build first, and how we would evidence it
We are not promising this work; it is a request and an argument, and we would rather agree the
tiering first. The order starts with the honesty set: refuse best_of above 1, refuse a
non-empty logit_bias, document the ignores — three server-only changes, no engine work at all.
Then a per-request seed, on the wire, because the SUBMIT header already has the namespace:
decode_batch.h names a future seed as the knob that should claim a key there. Two prerequisites:
- The extension value grammar cannot express a seed.
coli_submit_extaccumulates into anintwith a digit loop bounded by the top-k cap of 32, rejecting the frame once digits remain, so 329 is its largest expressible value and negatives have none. It needs a widened, signed path with the same no-sscanfoverflow discipline the comment there insists on. - The sampler RNG is one process-global, seeded once at startup, in every engine that samples
at all — DeepSeek V4 is greedy and has no RNG to seed. Three engines read
SEEDand otherwise randomise from the clock or the PID; the other five are reproducible only by accident, four on libc's defaultrand()seed and one on a literal. With batched decode, reseeding one global perturbs a request in flight, so this implies per-slot RNG state.
The caveat ships with the feature. On the GLM CPU expert path the S==1 fused-pair and S>=2 IDOT
kernels accumulate in different orders and float addition is not associative — measured, and the
reason speculative decoding is off by default under CUDA. Another engine holds the opposite as a
verified invariant: DeepSeek V4's batched expert union is oracle-checked token-exact against the
per-token path. So the honest promise across the fleet is same seed + same request + same batch
shape → same tokens — evidenced by a frame test pinning the unseeded SUBMIT header byte-identical,
one that a seeded request adds exactly one key, a same-seed repeat, and a different-batch-shape
case tested as not guaranteed.
Separate from the open PRs. logprobs, top_logprobs and echo are the subject of an open
pull request and are excluded from every tier above; where anything overlaps, that PR has right of
way. One line there is worth naming even so: the logprobs guard tests truthiness, so logprobs: 0
— legal on /v1/completions — is accepted silently while logprobs: 1 is refused. If the PR does
not cover it: the guard is shared by both routes and logprobs is an integer on one and a boolean
on the other, so the fix is per-route and typed, not a one-liner.
Alternatives considered
I thought about just building the seed PR, but this really should be scoped holistically as a coherent project rather than built piecemeal.
Scope and compatibility
Hopefully all of the engines and architectures. My interest is currently focused on the GLM 5.2/5.3 colibri engine, but there is no reason this layer shouldn't span the family of supported engines.
Source: JustVugg/colibri