<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 26.4.0 -",
    "visionOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/SystemLanguageModel/tokenCount(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels19SystemLanguageModelC10tokenCount3forSiAA12InstructionsV_tYaKF::OverloadGroup"
  },
  "title" : "tokenCount(for:)"
}
-->

# tokenCount(for:)

Returns the token count for the specified instructions.

```
nonisolated(nonsending) final func tokenCount(for instructions: Instructions) async throws -> Int
```

## Parameters

`instructions`

The instructions to calculate the token count for.

## Return Value

The token count for the instructions.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)