Skip to main content
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.
Custom grammar response format

Example Usage

import { ChatFormatGrammarConfig } from "@openrouter/sdk/models";

let value: ChatFormatGrammarConfig = {
  grammar: "root ::= \"yes\" | \"no\"",
  type: "grammar",
};

Fields

FieldTypeRequiredDescriptionExample
grammarstring:heavy_check_mark:Custom grammar for text generationroot ::= “yes” | “no”
type”grammar”:heavy_check_mark:N/A