> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ResponseFormat

Response format configuration

## Supported Types

### ChatFormatGrammarConfig

```go theme={null}
responseFormat := components.CreateResponseFormatGrammar(components.ChatFormatGrammarConfig{/* values here */})
```

### ChatFormatJSONObjectConfig

```go theme={null}
responseFormat := components.CreateResponseFormatJSONObject(components.ChatFormatJSONObjectConfig{/* values here */})
```

### ChatFormatJSONSchemaConfig

```go theme={null}
responseFormat := components.CreateResponseFormatJSONSchema(components.ChatFormatJSONSchemaConfig{/* values here */})
```

### ChatFormatPythonConfig

```go theme={null}
responseFormat := components.CreateResponseFormatPython(components.ChatFormatPythonConfig{/* values here */})
```

### ChatFormatTextConfig

```go theme={null}
responseFormat := components.CreateResponseFormatText(components.ChatFormatTextConfig{/* values here */})
```

## Union Discrimination

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

```go theme={null}
switch responseFormat.Type {
	case components.ResponseFormatTypeGrammar:
		// responseFormat.ChatFormatGrammarConfig is populated
	case components.ResponseFormatTypeJSONObject:
		// responseFormat.ChatFormatJSONObjectConfig is populated
	case components.ResponseFormatTypeJSONSchema:
		// responseFormat.ChatFormatJSONSchemaConfig is populated
	case components.ResponseFormatTypePython:
		// responseFormat.ChatFormatPythonConfig is populated
	case components.ResponseFormatTypeText:
		// responseFormat.ChatFormatTextConfig is populated
}
```
