> ## 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.

# PreferredMaxLatency - Go SDK

> PreferredMaxLatency type definition

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

Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.

## Supported Types

###

```go lines theme={null}
preferredMaxLatency := components.CreatePreferredMaxLatencyNumber(float64{/* values here */})
```

### PercentileLatencyCutoffs

```go lines theme={null}
preferredMaxLatency := components.CreatePreferredMaxLatencyPercentileLatencyCutoffs(components.PercentileLatencyCutoffs{/* values here */})
```

###

```go lines theme={null}
preferredMaxLatency := components.CreatePreferredMaxLatencyAny(any{/* values here */})
```

## Union Discrimination

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

```go lines theme={null}
switch preferredMaxLatency.Type {
	case components.PreferredMaxLatencyTypeNumber:
		// preferredMaxLatency.Number is populated
	case components.PreferredMaxLatencyTypePercentileLatencyCutoffs:
		// preferredMaxLatency.PercentileLatencyCutoffs is populated
	case components.PreferredMaxLatencyTypeAny:
		// preferredMaxLatency.Any is populated
}
```
