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

Add additionalProperties to GEMINI_UNSUPPORTED_SCHEMA_KEYS and test (#84)

Jake Hasha891de1e2f2d
diff --git a/server/src/__tests__/providers/google-schema.test.ts b/server/src/__tests__/providers/google-schema.test.ts
index bc6f952a..b4b536c2 100644
--- a/server/src/__tests__/providers/google-schema.test.ts
+++ b/server/src/__tests__/providers/google-schema.test.ts
@@ -87,6 +87,31 @@ describe('sanitizeForGemini', () => {
expect(sanitizeForGemini(input)).toEqual(input);
});
+ it('strips additionalProperties (Gemini rejects it with 400)', () => {
+ const input = {
+ type: 'object',
+ properties: {
+ name: { type: 'string' },
+ address: {
+ type: 'object',
+ properties: { street: { type: 'string' } },
+ additionalProperties: false,
+ },
+ },
+ additionalProperties: false,
+ };
+ expect(sanitizeForGemini(input)).toEqual({
+ type: 'object',
+ properties: {
+ name: { type: 'string' },
+ address: {
+ type: 'object',
+ properties: { street: { type: 'string' } },
+ },
+ },
+ });
+ });
+
it('handles primitives and null safely', () => {
expect(sanitizeForGemini(null)).toBe(null);
expect(sanitizeForGemini(undefined)).toBe(undefined);
diff --git a/server/src/providers/google.ts b/server/src/providers/google.ts
index 94535948..434925d4 100644
--- a/server/src/providers/google.ts
+++ b/server/src/providers/google.ts
@@ -79,6 +79,7 @@ const GEMINI_UNSUPPORTED_SCHEMA_KEYS = new Set([
'if', 'then', 'else',
'contentEncoding', 'contentMediaType', 'contentSchema',
'dependentRequired', 'dependentSchemas',
+ 'additionalProperties',
]);
export function sanitizeForGemini(schema: unknown): unknown {