> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter-d02e98a0-mintlify-5b6e02fd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Format - Go SDK

> Format type definition

<Warning>
  The Go SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/go-sdk/issues).
</Warning>

## Supported Types

### FormatText

```go lines theme={null}
format := components.CreateFormatText(components.FormatText{/* values here */})
```

### FormatGrammar

```go lines theme={null}
format := components.CreateFormatGrammar(components.FormatGrammar{/* values here */})
```

## Union Discrimination

Use the `Type` field to determine which variant is active, then access the corresponding field:

```go lines theme={null}
switch format.Type {
	case components.FormatTypeTextValue:
		// format.FormatText is populated
	case components.FormatTypeGrammarValue:
		// format.FormatGrammar is populated
	default:
		// Unknown type - use format.GetUnknownRaw() for raw JSON
}
```
