Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(gateway): permissive json_schema upgrade needs properties:{} (Reka 503s on a bare object schema) (#520)

Tashfeen8d0e167bf3f8
diff --git a/server/src/__tests__/lib/sampling-params.test.ts b/server/src/__tests__/lib/sampling-params.test.ts
index cd64e920..3e2e9bd3 100644
--- a/server/src/__tests__/lib/sampling-params.test.ts
+++ b/server/src/__tests__/lib/sampling-params.test.ts
@@ -114,7 +114,7 @@ describe('live-sweep policy findings (2026-07-11 demo-box validation)', () => {
it('reka: json_object upgraded to a permissive json_schema on the wire', () => {
const body = extendedBodyParams('reka', { response_format: { type: 'json_object' } });
expect((body.response_format as any).type).toBe('json_schema');
- expect((body.response_format as any).json_schema.schema).toEqual({ type: 'object' });
+ expect((body.response_format as any).json_schema.schema).toEqual({ type: 'object', properties: {}, additionalProperties: true });
});
it('reka: an explicit json_schema passes through untouched', () => {
diff --git a/server/src/lib/sampling-params.ts b/server/src/lib/sampling-params.ts
index 9e39dc49..717b95dc 100644
--- a/server/src/lib/sampling-params.ts
+++ b/server/src/lib/sampling-params.ts
@@ -152,10 +152,13 @@ export const PLATFORM_PARAM_POLICIES: Record<string, PlatformParamPolicy> = {
};
// The permissive schema a json_object request is upgraded to on platforms
-// that only accept json_schema (any JSON object satisfies it).
+// that only accept json_schema (any JSON object satisfies it). The empty
+// `properties` map matters: Reka 503s on a bare {type:'object'} but accepts
+// this shape (probed live 2026-07-11); additionalProperties keeps arbitrary
+// keys legal.
const ANY_OBJECT_SCHEMA = {
type: 'json_schema' as const,
- json_schema: { name: 'json_output', schema: { type: 'object' } },
+ json_schema: { name: 'json_output', schema: { type: 'object', properties: {}, additionalProperties: true } },
};
/**