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

# Formats - Go SDK

> Formats type definition

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

Text response format configuration

## Supported Types

### FormatTextConfig

```go lines theme={null}
formats := components.CreateFormatsText(components.FormatTextConfig{/* values here */})
```

### FormatJSONObjectConfig

```go lines theme={null}
formats := components.CreateFormatsJSONObject(components.FormatJSONObjectConfig{/* values here */})
```

### FormatJSONSchemaConfig

```go lines theme={null}
formats := components.CreateFormatsJSONSchema(components.FormatJSONSchemaConfig{/* values here */})
```

## Union Discrimination

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

```go lines theme={null}
switch formats.Type {
	case components.FormatsTypeText:
		// formats.FormatTextConfig is populated
	case components.FormatsTypeJSONObject:
		// formats.FormatJSONObjectConfig is populated
	case components.FormatsTypeJSONSchema:
		// formats.FormatJSONSchemaConfig is populated
	default:
		// Unknown type - use formats.GetUnknownRaw() for raw JSON
}
```
