# Function calculateTokenCost

- calculateTokenCost(tokens: ObserverTokenUsage, ratePerThousand: number): number

  Calculates the cost for token usage based on rate.

  #### Parameters

  - tokens: ObserverTokenUsage

    Token usage to calculate cost for

  - ratePerThousand: number

    Cost rate per 1000 tokens

  #### Returns number

  The calculated cost in USD

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-helpers.ts:277