# AI Token Calculator for GitHub Copilot

> Count tokens in a prompt, code, JSON or log, see what a request costs in AI Credits on 29 GitHub Copilot models, and learn how Copilot bills tokens in 9 short lessons.

- **Author:** Suthahar Jegatheesan (MSDEVBUILD)
- **Updated:** 2026-11-07
- **Interactive version:** https://blog.msdevbuild.com/open-source/ai-token-calculator/
- **Prices:** GitHub’s published per-1M-token rates (https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing), checked 6 November 2026. 1 AI Credit = $0.01.
- **Privacy:** the calculator counts tokens in the browser with gpt-tokenizer; text is never sent to a server.

## Lesson 1: How Copilot counts tokens

Everything you send to Copilot and everything it writes back is counted in tokens. Since June 1, 2026, those tokens are what your organization pays for, in GitHub AI Credits. Start with the one-line idea below, then follow the numbered steps.

### How does GitHub Copilot count and bill tokens?

Copilot adds up four kinds of tokens per request: input (everything sent), cached input (repeated parts, usually 10% of the input price, 25% on Grok), cache writes (storing a prefix for reuse, about 1.25× input, on Anthropic and the newer GPT families) and output (everything written back, about 5× the input price). Each is multiplied by the model’s price, and the total is billed in AI Credits.

Read more: [What Is an AI Token? Why Every AI Cost Is Calculated in Them](https://blog.msdevbuild.com/blog/what-is-ai-token-cost-calculated/)

## Lesson 2: Learn tokens, scene by scene

A short animated lesson in ten scenes, from “what is a token?” to what a request costs. Press Play lesson and watch, or pick a scene and go at your own pace. The arrow keys move between scenes.

### What is a token in AI?

A token is a small piece of text that a language model reads and writes: often a whole short word, or part of a longer one. In English, one token is about 4 characters or three quarters of a word, so 100 tokens is roughly 75 words.

Read more: [What Is an AI Token? Why Every AI Cost Is Calculated in Them](https://blog.msdevbuild.com/blog/what-is-ai-token-cost-calculated/)

## Lesson 3: Watch the model generate

A language model writes by repeatedly predicting the most likely next token. Press Play to watch, or Step to go one token at a time.

### Why do output tokens cost more than input tokens?

The model reads all input tokens together in one pass, but writes output one token at a time, with a separate pass for each. Every model on GitHub’s list prices output higher, 3–8 times the input price and 5 times on most.

Read more: [What Is an AI Token? Why Every AI Cost Is Calculated in Them](https://blog.msdevbuild.com/blog/what-is-ai-token-cost-calculated/)

## Lesson 4: The best way to ask

The cheapest prompt is the one that gets the right answer first time. A focused prompt is often a little longer, but it avoids retries, exploring and long answers, which is where most tokens go.

### How do I write a prompt that uses fewer tokens?

Name the exact file or method, say what to change, give the rules to follow, and say what to return, such as only the diff. A focused prompt can be a little longer, but it avoids exploring, retries and long answers, which is where most tokens go.

Read more: [How to Save AI Tokens: 15 Habits That Cut My Copilot Context Waste](https://blog.msdevbuild.com/blog/save-ai-tokens-tips-copilot-context/)

### Prompt makeover: how people ask, and the best way to ask

**Instead of “fix this”, ask:**

- *Task:* Fix the crash when the cart is empty on the checkout screen.
- *Context:* #file:lib/features/checkout/bloc/checkout_bloc.dart, stack trace selected.
- *Constraints:* Keep the existing BLoC events.
- *Done when:* Show only the changed method.

Why: Names the bug and where it happens, so Copilot does not explore to find it. The stack trace points straight at the cause. “Only the changed method” keeps the output, the priciest part, short.

**Instead of “explain this code”, ask:**

- *Task:* Explain what CartBloc does when an item is removed,
- *Context:* #file:lib/features/cart/bloc/cart_bloc.dart
- *Constraints:* for a developer new to BLoC,
- *Done when:* in 5 short bullet points.

Why: One behaviour, not the whole file. Says who the answer is for, so it is neither too basic nor too deep. A length limit stops a long essay you would only skim.

**Instead of “write tests for this”, ask:**

- *Task:* Write unit tests for CartBloc: add item, remove item, empty cart.
- *Context:* #file:lib/features/cart/bloc/cart_bloc.dart, existing tests in test/bloc.
- *Constraints:* Follow the style of the existing tests. No new packages.
- *Done when:* Tests only. Run them and report any failure.

Why: Lists the cases, so Copilot does not invent twenty of its own. Pointing at existing tests means the first version matches the team’s style. A clear finish line: tests written, run, and reported.

**Instead of “can you make this better”, ask:**

- *Task:* Split the build method in checkout_screen.dart into smaller widgets.
- *Context:* #file:lib/features/checkout/presentation/checkout_screen.dart
- *Constraints:* No changes to behaviour or layout.
- *Done when:* Show the new widgets and the updated build method only.

Why: “Better” can mean anything, so the model guesses and you retry. One concrete change, with what must not change. Only the new and changed code comes back, not the whole file.

**Instead of “why is it not working??”, ask:**

- *Task:* The cart total does not update after removing an item.
- *Context:* #file:lib/features/cart/bloc/cart_bloc.dart. Expected 2 items; the screen still shows 3.
- *Constraints:* Find the cause before changing any code.
- *Done when:* Explain the cause in 2 sentences, then give the minimal fix.

Why: Describes what you see and what you expected: the two facts debugging needs. Asking for the cause first stops a rewrite that hides the real bug. A short, two-part answer instead of a long guess.

**Instead of “add google login to my app”, ask:**

- *Task:* Plan Google sign-in for the auth feature.
- *Context:* #file:lib/features/auth/presentation/login_screen.dart and the auth bloc.
- *Constraints:* Follow the flutter-feature skill. No code yet.
- *Done when:* A numbered plan of at most 8 steps.

Why: A big feature asked in one go turns into a long, costly agent run. A plan is cheap, and you can correct it before any code is written. The skill gives the agent the repo’s structure, so it does not guess.

**Instead of “review my code pls”, ask:**

- *Task:* Review this diff for null-safety and BLoC state bugs.
- *Context:* The diff selected in the editor.
- *Constraints:* Ignore formatting and naming.
- *Done when:* At most 5 issues, most serious first.

Why: Says what to look for, so the review is not a list of style nits. Only the diff is sent, not the whole project. A cap keeps the answer focused on what matters most.

**Instead of “Hi Copilot! Hope you are doing well. Could you please help me, if possible, with adding a loading spinner? Thanks a lot!!”, ask:**

- *Task:* Add a loading spinner to the checkout screen while the order is being placed.
- *Context:* #file:lib/features/checkout/presentation/checkout_screen.dart
- *Constraints:* Use the existing theme colours.
- *Done when:* Show only the changed widget.

Why: Greetings and thanks do not change the answer; the missing details do. The spinner now has a place and a moment to appear. Every token goes into instructions the model can act on.

**Instead of “continue what we did yesterday”, ask:**

- *Task:* Continue the promo-code work.
- *Context:* #file:PLAN.md, with the decisions so far and the open tasks.
- *Constraints:* Stay on the plan. Ask before changing it.
- *Done when:* Do step 3 of the plan, then stop.

Why: A new chat remembers nothing from yesterday; the plan file gives it the context in a few hundred tokens. Far cheaper than pasting, or re-sending, the whole old chat. A clear stopping point keeps the run short.

## Lesson 5: Continue the chat, or start fresh?

Every message re-sends the whole chat. Sometimes that is the cheapest way to work, and sometimes the most expensive. Here is how to tell, and how to carry your context over when you do start again.

### Does continuing a Copilot chat cost more than starting a new one?

It depends on the cache and the topic. Each message re-sends the whole chat, but soon after the last message most of it is read from cache, usually at 10% of the input price or less. A quick follow-up on the same task is usually cheapest in the same chat; after a break, or for a new topic, a new chat with a short summary costs less.

### Why and how should I start a new chat in GitHub Copilot?

Every message re-sends the whole chat, so on a new task the old history costs tokens and pulls answers off topic. In VS Code type /clear or press Ctrl+N (⌘N on macOS); in Copilot CLI use /clear; in Visual Studio select Create new thread. /compact summarizes instead of clearing.

Read more: [How to Save AI Tokens: 15 Habits That Cut My Copilot Context Waste](https://blog.msdevbuild.com/blog/save-ai-tokens-tips-copilot-context/) · [400K AI Tokens a Month: My Daily GitHub Copilot Workflow That Makes the Budget Last](https://blog.msdevbuild.com/blog/ai-token-budget-daily-copilot-workflow/)

## Lesson 6: Calculation patterns

The same price formula behaves very differently depending on how you work. Pick a pattern, move the sliders, and watch each model call stack up.

### Why does a long chat or agent session cost so much more?

The model keeps no memory, so every new message or agent step re-sends the whole conversation so far. Input grows each turn, so total tokens rise much faster than the number of questions. Caching and a new chat for a new topic keep it down.

Read more: [400K AI Tokens a Month: My Daily GitHub Copilot Workflow That Makes the Budget Last](https://blog.msdevbuild.com/blog/ai-token-budget-daily-copilot-workflow/) · [Designing a Multi-Agent GitHub Copilot Orchestrator for Legacy Teams (Honestly)](https://blog.msdevbuild.com/blog/github-copilot-multi-agent-orchestrator-legacy-teams/)

## Lesson 7: Instructions, skills & hooks

Copilot lets you add knowledge and automation to every session. Each piece enters the model’s context at a different moment, so each has a different token cost.

### Do custom instructions, skills and hooks use tokens?

Custom instructions are sent with every request, so keep them short. Copilot loads a skill only when it judges the skill relevant, so its steps aren’t in every request. Hooks run as commands outside the model (in Copilot CLI and Copilot cloud agent) and use no model tokens unless they add text to the context.

Read more: [What Is GitHub Copilot Custom Instructions? (And Why Your Project Needs One)](https://blog.msdevbuild.com/blog/github-copilot-custom-instructions/) · [GitHub Copilot Skills Deep Dive: The Missing Layer Between Prompts, Instructions, and Agents](https://blog.msdevbuild.com/blog/github-copilot-skills-deep-dive/) · [GitHub Copilot Hooks for Beginners: Why You Need Them and What You Can Build](https://blog.msdevbuild.com/blog/github-copilot-hooks-for-beginners/)

## Lesson 8: How to write them well

Templates, do’s and don’ts for instructions, custom agents, skills and hooks. Start with “Which one do I need?”, then open the tab you need.

### Should I use instructions, a skill, a custom agent or a hook?

Use custom instructions for what every request needs, path-specific instructions for rules on some files, a skill for a detailed recipe some tasks need, a custom agent for a specialist role, a hook for what must always happen, and a prompt file for a prompt you repeat.

Read more: [The Complete AGENTS.md Playbook: Build AI Coding Agents That Work Like Your Best Engineer](https://blog.msdevbuild.com/blog/agents-md-complete-playbook/) · [Building Your First GitHub Copilot Skill: A .NET Clean Architecture SKILL.md, Start to Finish](https://blog.msdevbuild.com/blog/build-first-github-copilot-skill-dotnet-clean-architecture/) · [GitHub Copilot Hooks for Beginners: Why You Need Them and What You Can Build](https://blog.msdevbuild.com/blog/github-copilot-hooks-for-beginners/)

## Lesson 9: Habits and final check

Habits that keep usage low without lowering quality, then ten questions, one on each big idea, to check your understanding.

### What are the best habits to save GitHub Copilot tokens?

Attach only the code that matters, ask for diffs instead of whole files, stay on one model during a task, start a new chat for a new topic, use a light model for routine work, and keep instructions short. None of these lowers answer quality.

Read more: [How to Save AI Tokens: 15 Habits That Cut My Copilot Context Waste](https://blog.msdevbuild.com/blog/save-ai-tokens-tips-copilot-context/) · [400K AI Tokens a Month: My Daily GitHub Copilot Workflow That Makes the Budget Last](https://blog.msdevbuild.com/blog/ai-token-budget-daily-copilot-workflow/)

## Final check

1. Which kind of token is usually priced highest? — **Output.** Output is about 5× the input price on most models, because each output token needs its own pass.
2. About how many English words are 100 tokens? — **75.** One token is about ¾ of a word, so 100 tokens is roughly 75 words.
3. Your 10-token question is sent with 12,000 tokens of context. How many input tokens are billed? — **About 12,000.** Everything in the request is input: the question and all the context packed around it.
4. Hidden “thinking” tokens from reasoning models are billed as… — **Output tokens.** On most models, reasoning is billed as output, so higher effort costs more.
5. What throws the cache away in the middle of a chat? — **Switching to another model.** A new model cannot reuse another model’s cache, so the whole history is billed at full price again.
6. As a chat gets longer, total input tokens grow… — **Much faster, roughly with the square of the turns.** Each turn re-sends all earlier turns, so the total climbs faster and faster.
7. A GPT-5.6 Sol request goes above 272K input tokens. What happens? — **The whole request is billed at the higher long-context rate.** Crossing the threshold raises the price for the entire request, not just the excess.
8. Why can agent mode cost much more under AI Credits? — **Every model call in the agent loop is billed.** One prompt can start many calls, and each call re-sends the growing context.
9. Which of these is sent with every single request? — **The custom instructions file.** Instructions ride along on every call, which is why every line in them has a cost.
10. A rule that must be enforced every time, whatever the model decides, belongs in… — **A hook.** Hooks run your command at a set moment, so they do not rely on the model remembering.

## How do I count the tokens in my text?

Paste it into a tokenizer for the model family you use. OpenAI publishes its tokenizers, so the o200k_base count here is exact for that encoding and a close estimate for GPT models. Anthropic, Google and the other providers don’t publish browser tokenizers, so their counts are estimated ranges; for exact figures, use the provider’s token-counting API or your Copilot usage report.

## How are GitHub Copilot AI Credits calculated?

Multiply fresh input, cached input and output tokens by the model’s price per million tokens, add them, and convert: 1 AI Credit is $0.01. For example, 12,000 input and 800 output tokens on Claude Sonnet 5.5 cost 3.2 credits.

## GitHub Copilot model prices (USD per 1M tokens)

| Model | Provider | Input | Cached | Cache write | Output | Long context |
| --- | --- | ---: | ---: | ---: | ---: | --- |
| GPT-6 Luna | OpenAI | $0.1 | $0.01 | $0.125 | $0.5 | above 272K input: $0.2 / $0.75 |
| GPT-5.4 nano | OpenAI | $0.2 | $0.02 | — | $1.25 | — |
| GPT-5.6 Luna | OpenAI | $0.2 | $0.02 | $0.25 | $1.2 | above 200K input: $0.4 / $1.8 |
| GPT-6.1 Terra | OpenAI | $1 | $0.05 | $1.25 | $5 | above 272K input: $2 / $7.5 |
| GPT-5.3-Codex | OpenAI | $1.75 | $0.175 | — | $14 | — |
| GPT-5.6 Terra | OpenAI | $2 | $0.2 | $2.5 | $12 | above 272K input: $4 / $18 |
| GPT-6 Sol | OpenAI | $2 | $0.2 | $2.5 | $10 | above 272K input: $4 / $15 |
| GPT-6.1 Sol | OpenAI | $2 | $0.1 | $2.5 | $10 | above 272K input: $4 / $15 |
| GPT-5.6 Sol | OpenAI | $4 | $0.4 | $5 | $20 | above 272K input: $8 / $30 |
| GPT-6 Astra | OpenAI | $10 | $1 | $12.5 | $50 | above 272K input: $20 / $75 |
| Claude Haiku 5.5 | Anthropic | $0.1 | $0.01 | $0.125 | $0.5 | above 100K input: $0.5 / $2.5 |
| Claude Haiku 4.5 | Anthropic | $1 | $0.1 | $1.25 | $5 | — |
| Claude Sonnet 5.5 | Anthropic | $2 | $0.1 | $2.5 | $10 | — |
| Claude Sonnet 5 | Anthropic | $2 | $0.2 | $2.5 | $10 | — |
| Claude Sonnet 4.6 | Anthropic | $3 | $0.3 | $3.75 | $15 | — |
| Claude Sonnet 4 | Anthropic | $3 | $0.3 | $3.75 | $15 | — |
| Claude Opus 5.5 | Anthropic | $4 | $0.2 | $5 | $20 | — |
| Claude Opus 5 | Anthropic | $5 | $0.5 | $6.25 | $25 | — |
| Claude Opus 4.8 | Anthropic | $5 | $0.5 | $6.25 | $25 | — |
| Claude Opus 4.8 (fast mode) | Anthropic | $10 | $1 | $12.5 | $50 | — |
| Claude Fable 5 | Anthropic | $10 | $1 | $12.5 | $50 | — |
| Claude Fable 5.1 | Anthropic | $10 | $0.25 | $12.5 | $50 | — |
| Gemini 3.8 Flash | Google | $0.75 | $0.075 | — | $3.75 | — |
| Gemini 4 Argon | Google | $2 | $0.1 | — | $10 | — |
| MAI-Code-1.1-Flash | Microsoft | $0.2 | $0.02 | — | $1.2 | — |
| Grok 4.5 | xAI | $2 | $0.5 | — | $6 | above 200K input: $4 / $12 |
| Grok 4.6 | xAI | $2 | $0.5 | — | $6 | above 200K input: $4 / $12 |
| Grok 4.7 | xAI | $2 | $0.5 | — | $6 | above 200K input: $4 / $12 |
| Kimi K3 | Moonshot AI | $3 | $0.3 | — | $15 | — |

## Frequently asked questions

### Is this AI Token Calculator free, and is my text sent anywhere?

It is free, and your text stays in your browser. Tokens are counted by the open-source gpt-tokenizer library running on the page, so nothing you paste is sent to a server or an AI provider. The site uses Google Analytics to count page views; it is not sent your text.

### How many tokens is 1,000 words?

About 1,300 tokens of English, using the rule that one token is roughly three quarters of a word. Code, JSON and logs use more tokens for the same length, because symbols and indentation are tokens too.

### How accurate are the Claude and Gemini token counts?

They are estimates. Anthropic and Google do not publish browser tokenizers, so the calculator shows a range based on typical differences from the OpenAI count. For exact numbers, use the provider’s token-counting API or your Copilot usage report.

### Are GitHub Copilot code completions billed in AI Credits?

No. On paid plans, inline code completions and next edit suggestions do not use AI Credits. Copilot Chat, agent mode, Copilot CLI and code review do.

### How many AI Credits come with Copilot Business and Enterprise?

Copilot Business includes $19 of credits per user each month (1,900 AI Credits) and Enterprise includes $39 (3,900). Credits are pooled across the organization and reset on the 1st of each month.

### What is cached input, and how much does it save?

Cached input is the repeated start of a request, such as instructions and earlier messages, reused from a recent call. It is billed at a fraction of the normal input price, usually 10% or less (5% on Claude Sonnet 5.5), but the cache is lost if you switch models or wait too long.

### Why is Copilot agent mode more expensive than a chat question?

One agent task runs many model calls, and each call re-sends the growing conversation plus the latest tool output. Twenty calls can add up to hundreds of thousands of input tokens, while a chat question is a single call.

### Are thinking tokens from reasoning models billed?

Yes. Model providers bill the hidden reasoning written before the answer as output tokens, the most expensive kind; GitHub prices Copilot requests by input, cached and output tokens. Higher reasoning effort means more thinking tokens, so raise it only for hard problems.

### Where can I see my real GitHub Copilot token usage?

In your GitHub billing settings under AI usage, which shows credits by feature and model. You can also download the usage report for per-request model and token detail. The figures on this page are estimates.

### Are the model prices on this page current?

They are GitHub’s published per-million-token rates, checked on 6 November 2026, including the higher long-context rates some models charge above a size threshold. Prices change, so check GitHub’s Copilot models and pricing page before you plan a budget.
