diff --git a/src/upstream/translator.ts b/src/upstream/translator.ts index 6410787..d4b14d2 100644 --- a/src/upstream/translator.ts +++ b/src/upstream/translator.ts @@ -201,7 +201,6 @@ export function openaiToAnthropic(body: any): any { format: { type: "json_schema", schema: fmt.json_schema.schema, - name: fmt.json_schema.name, }, }; } else if (fmt.type === "json_object") { @@ -580,7 +579,6 @@ export function responsesToAnthropic(body: any): any { format: { type: "json_schema", schema: fmt.schema, - name: fmt.name, }, }; } else if (fmt.type === "json_object") { diff --git a/tests/unit.test.ts b/tests/unit.test.ts index 6f235d6..703b3da 100644 --- a/tests/unit.test.ts +++ b/tests/unit.test.ts @@ -568,7 +568,11 @@ test("openaiToAnthropic translates response_format json_schema", () => { }, }); assert.equal(result.output_config.format.type, "json_schema"); - assert.equal(result.output_config.format.name, "test"); + // Anthropic's Messages API rejects an extra `name` field here with + // "Extra inputs are not permitted" (verified against the live API) -- + // unlike OpenAI's json_schema format, Anthropic's output_config.format + // only accepts { type, schema }. + assert.equal(result.output_config.format.name, undefined); }); test("openaiToAnthropic translates tool role messages", () => {