---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/anthropic_messages/count_tokens/functions/countAnthropicMessagesTokensWithResolvedOptions.md
---

# Function: countAnthropicMessagesTokensWithResolvedOptions()

```ts
function countAnthropicMessagesTokensWithResolvedOptions(
  resolved: AnthropicMessagesAdapterOptions,
  input:
    | AnthropicMessagesCountTokensRequestInput
    | AnthropicMessagesCountTokensInput,
  deps?: AnthropicMessagesCountTokensDeps,
): Promise<{
  inputTokens: number;
  raw: unknown;
}>;
```

Defined in: [src/batteries/llm/anthropic\_messages/count\_tokens.ts:383](https://github.com/NHTIO/ADK/blob/v1.20260726.0/src/src/batteries/llm/anthropic_messages/count_tokens.ts#L383)

Counts tokens using already-resolved Anthropic adapter options.

## Parameters

| Parameter  | Type                                                                                                                                                                                                               | Description                                                              |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `resolved` | [`AnthropicMessagesAdapterOptions`](../../types/interfaces/AnthropicMessagesAdapterOptions.md)                                                                                                                     | Fully merged and validated adapter options.                              |
| `input`    | | [`AnthropicMessagesCountTokensRequestInput`](../type-aliases/AnthropicMessagesCountTokensRequestInput.md) | [`AnthropicMessagesCountTokensInput`](../../types/interfaces/AnthropicMessagesCountTokensInput.md) | Either a `DispatchContext` or a pre-built Anthropic-shaped input object. |
| `deps?`    | [`AnthropicMessagesCountTokensDeps`](../interfaces/AnthropicMessagesCountTokensDeps.md)                                                                                                                            | Optional helper dependencies, including the structured log channel.      |

## Returns

`Promise`<{
`inputTokens`: `number`;
`raw`: `unknown`;
}>

The named token-count field plus the raw SDK response.
