Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
    • Cost Arithmetic
      • The Cost Formula
      • A Code-Review Job
      • A Nightly Regression Summary
      • Sensitivity and a Cost Calculator
    • Latency and Throughput
    • Reducing Tokens
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Cost Arithmetic
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Tokens, Cost and Latency
  4. Cost Arithmetic
  5. The Cost Formula

Reference: Tokens, Cost and Latency · Beginner to Intermediate

The Cost Formula

The cost formula with EXAMPLE prices and one fully worked single call.

On this page

    The cost formula

    Each call costs input tokens times the input price plus output tokens times the output price. Both prices are EXAMPLE parameters, quoted per 1M tokens in abstract units.

    Dividing the token count by one million before multiplying keeps the units straight. The result is a small number of EXAMPLE units per call.

    Symbol

    Meaning

    EXAMPLE value

    in_tokens

    Input tokens in one call

    8000

    in_price

    EXAMPLE units per 1M input tokens

    3

    out_tokens

    Output tokens in one call

    500

    out_price

    EXAMPLE units per 1M output tokens

    12

    total

    in_tokens / 1M x in_price + out_tokens / 1M x out_price

    0.030 units

    Input and output tokens

    Tokens are subword units, and the common approach is BPE-like chunking. Roughly 3 to 4 characters per token holds for English prose with common tokenizers, with fewer per token for code, numbers, hex and non-Latin text.

    That rule is approximate and tokenizer-dependent. Exact counts vary by model, so measure them on the tool in use.

    A worked single call

    Take 8000 input tokens and 500 output tokens at the EXAMPLE prices. The calc block substitutes and adds.

    plaintext
    1
    2
    3
    4
    5
    6
    EXAMPLE prices (not real prices): 3 units per 1M input tokens, 12 units per 1M output tokens
    single call: 8000 input tokens, 500 output tokens
    input part  = 8000 / 1000000 x 3 = 0.024 units
    output part = 500 / 1000000 x 12 = 0.006 units
    total = 0.024 + 0.006 = 0.030 units
    output share = 0.006 / 0.030 = 20%

    The output rate is four times the input rate, yet input dominates here. Counts beat rates when the counts differ by more than the rates do.

    Common pitfall

    Comparing the two rates instead of the two products misleads. Always multiply first: a high output rate on a short reply is still small.

    Interview

    Likely probes: units of each term, and why input usually dominates.

    • Each product is tokens divided by one million times units per million, leaving units.

    • Input counts are usually far larger than output counts in review and summary jobs.

    • The output share here is 20%, a number worth recomputing for each new job.

    Check yourself What are the units of the input price, and what units survive the multiplication?

    EXAMPLE units per 1M tokens. Multiplying by a token count leaves plain EXAMPLE units.

    Check yourself Input doubles from 8000 to 16000 while output stays at 500. What is the new total?

    The input part doubles to 0.048 units. The total is 0.048 + 0.006 = 0.054 units.

    Related topics

    • A code-review job

    • Tokens and tokenization

    Previous

    131 / 173

    Next: A Code-Review Job

    Up next

    Up nextA Code-Review Job

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • A Nightly Regression Summary
    • Sensitivity and a Cost Calculator