---
title: contextSize
framework: foundationmodels
role: symbol
role_heading: Instance Property
path: foundationmodels/systemlanguagemodel/contextsize
---

# contextSize

Returns the maximum context size (in tokens) supported by the model.

## Declaration

```swift
@backDeployed(before: iOS 26.4, macOS 26.4, visionOS 26.4)
final var contextSize: Int { get }
```

## Mentioned in

Managing the context window

## Return Value

Return Value The maximum number of tokens the model can process in a single context.

## Discussion

Discussion The context size represents the total number of tokens that can be used in a single session, including both input prompts and generated responses. note: An error if the context size cannot be determined. Typically this is due to the model not being available or Apple Intelligence is disabled.

## See Also

### Inspecting model capabilities

- [supportedLanguages](foundationmodels/systemlanguagemodel/supportedlanguages.md)
- [supportsLocale(_:)](foundationmodels/systemlanguagemodel/supportslocale(_:).md)
