Release and model choices
The launch announcement makes both models available in GitHub Copilot, with Code 2 Flash in limited-access preview in Microsoft Foundry. Availability in a product is different from a universally available API endpoint.
Microsoft's published performance and cost comparisons use specific coding benchmarks, reasoning settings and promotional pricing. They do not establish a general ranking across science, long-horizon agents or every development task.
| Model | Local counting | Open tool |
|---|---|---|
| MAI Code 2 | Reference encoding | Select MAI Code 2 |
| MAI Code 2 Flash | Reference encoding | Select MAI Code 2 Flash |
How to count MAI Code 2 tokens
Uses o200k_base for text comparison only. This site has not verified a browser tokenizer for MAI Code 2. The displayed count, boundaries and IDs belong to o200k_base and must not be treated as MAI Code 2 usage, a billing estimate or a context-limit guarantee.
Paste text into Plain text mode, or use Chat messages to count each message body independently. Switching models preserves your input. Chat mode excludes role names, separators and provider wrappers; adding bodies does not reproduce a serialized API conversation.
Local processing does not send your prompt to a model API or generate a response. Published tokenizer assets may be loaded by the browser, while the text analysis itself runs on your device.
Request limits and usage
Tiktokenizer has not verified a browser tokenizer for either MAI model. Its internal microsoft/ selection IDs are tool identifiers, not promised API deployment names. Use the deployment's documentation and reported usage for production accounting.
For a production request, include the actual conversation, system instructions, tool schemas and supported media in the provider's counting workflow when available. Check response usage after generation and account for subsequent calls, cache behavior, reasoning and output separately.
- A model's advertised context window is not a guaranteed amount of pasted text.
- A faster model or a cheaper token rate does not establish a lower total bill for every task.
- Recheck the exact model version and counting method when migrating an existing prompt.
Tiktokenizer Reference Sources
Tokenizer behavior and model limits change. Verify production decisions with current provider documentation: