Problem
getCompat(model) in openai-transport-stream-aPa0aR5w.js builds a new compat object from model.compat but only copies specific known fields — it does NOT include unsupportedToolSchemaKeywords. So even when a model's catalog entry has compat.unsupportedToolSchemaKeywords: ["not"], the keyword is stripped from the compat object before it reaches the tool schema builder.
Call Chain Issue
The downstream call chain is:
buildOpenAICompletionsParams calls convertTools(context.tools, compat, model) — here compat is the result of getCompat(model) which is missing unsupportedToolSchemaKeywords
convertTools calls normalizeOpenAIStrictToolParameters(tool.parameters, strict === true) — no compat passed
normalizeOpenAIStrictToolParameters calls normalizeToolParameterSchema(schema ?? {}) — no options passed
normalizeToolParameterSchema calls resolveUnsupportedToolSchemaKeywords(options?.modelCompat) — gets undefined, returns empty Set, no keywords stripped
Symptom
Fireworks (kimi-k2p5-turbo) returns 400 JSON Schema not supported: could not understand the instance {'not': {}} on every request, because {"not":{}} (from a Zod z.never() in a tool schema) is never stripped despite compat.unsupportedToolSchemaKeywords: ["not"] being in the catalog.
Impact
attempt-dispatch latency: 11-22s (failing + fallback) vs expected 3-4s
- Fireworks model completely non-functional for tool use
Solution
Thread model.compat directly (not the result of getCompat()) through the call chain:
// In normalizeStrictOpenAIJsonSchema — add modelCompat param and pass to normalizeToolParameterSchema
function normalizeStrictOpenAIJsonSchema(schema, modelCompat) {
return normalizeStrictOpenAIJsonSchemaRecursive(normalizeToolParameterSchema(schema ?? {}, { modelCompat }), 0);
}
// In normalizeOpenAIStrictToolParameters — add modelCompat param and pass through
function normalizeOpenAIStrictToolParameters(schema, strict, modelCompat) {
if (!strict) return normalizeToolParameterSchema(schema ?? {}, { modelCompat });
return normalizeStrictOpenAIJsonSchema(schema, modelCompat);
}
// In convertResponsesTools — pass model.compat (line ~1030)
parameters: normalizeOpenAIStrictToolParameters(tool.parameters, strict === true, model.compat)
// In convertTools — pass model.compat (line ~2016)
parameters: normalizeOpenAIStrictToolParameters(tool.parameters, strict === true, model.compat),
Note: model.compat is passed directly (not the output of getCompat(model)) because extractModelCompat() handles both shapes — if passed an object without a compat key, it returns the object itself as the compat.
Additional Change Required
The built-in Fireworks catalog entry for kimi-k2p5-turbo needs compat.unsupportedToolSchemaKeywords: ["not"] added (in the source that compiles to provider-catalog-BV3NRbEh.js):
{
"id": "accounts/fireworks/routers/kimi-k2p5-turbo",
// ... existing fields ...
"compat": {
"unsupportedToolSchemaKeywords": ["not"]
}
}
Verification
After applying both patches, Fireworks requests succeed and attempt-dispatch latency dropped from 11-22s to 3-4s.
Problem
getCompat(model)inopenai-transport-stream-aPa0aR5w.jsbuilds a new compat object frommodel.compatbut only copies specific known fields — it does NOT includeunsupportedToolSchemaKeywords. So even when a model's catalog entry hascompat.unsupportedToolSchemaKeywords: ["not"], the keyword is stripped from the compat object before it reaches the tool schema builder.Call Chain Issue
The downstream call chain is:
buildOpenAICompletionsParamscallsconvertTools(context.tools, compat, model)— herecompatis the result ofgetCompat(model)which is missingunsupportedToolSchemaKeywordsconvertToolscallsnormalizeOpenAIStrictToolParameters(tool.parameters, strict === true)— no compat passednormalizeOpenAIStrictToolParameterscallsnormalizeToolParameterSchema(schema ?? {})— no options passednormalizeToolParameterSchemacallsresolveUnsupportedToolSchemaKeywords(options?.modelCompat)— getsundefined, returns empty Set, no keywords strippedSymptom
Fireworks (
kimi-k2p5-turbo) returns400 JSON Schema not supported: could not understand the instance {'not': {}}on every request, because{"not":{}}(from a Zodz.never()in a tool schema) is never stripped despitecompat.unsupportedToolSchemaKeywords: ["not"]being in the catalog.Impact
attempt-dispatchlatency: 11-22s (failing + fallback) vs expected 3-4sSolution
Thread
model.compatdirectly (not the result ofgetCompat()) through the call chain:Note:
model.compatis passed directly (not the output ofgetCompat(model)) becauseextractModelCompat()handles both shapes — if passed an object without acompatkey, it returns the object itself as the compat.Additional Change Required
The built-in Fireworks catalog entry for
kimi-k2p5-turboneedscompat.unsupportedToolSchemaKeywords: ["not"]added (in the source that compiles toprovider-catalog-BV3NRbEh.js):Verification
After applying both patches, Fireworks requests succeed and
attempt-dispatchlatency dropped from 11-22s to 3-4s.