Skip to content

Interface: AnthropicOutputFormat

@providerprotocol/ai


@providerprotocol/ai / anthropic / AnthropicOutputFormat

Defined in: src/providers/anthropic/types.ts:257

Native structured output format configuration.

When provided, Claude’s response will be constrained to match the specified JSON schema. Requires the beta header structured-outputs-2025-11-13.

const outputFormat: AnthropicOutputFormat = {
type: 'json_schema',
schema: {
type: 'object',
properties: {
name: { type: 'string' },
age: { type: 'integer' },
},
required: ['name', 'age'],
additionalProperties: false,
},
};

schema: object

Defined in: src/providers/anthropic/types.ts:261

JSON Schema defining the expected response structure.

optional additionalProperties: false

Must be false for structured outputs.

properties: Record<string, unknown>

Property definitions for each field.

optional required: string[]

List of required property names.

type: "object"

Schema type (always ‘object’ for structured outputs).


type: "json_schema"

Defined in: src/providers/anthropic/types.ts:259

Output format type - currently only ‘json_schema’ is supported.