Model Guide2026-11-20Updated 2026-11-20

MAI Code 2 Flash Explained

TL;DRMicrosoft released MAI Code 2 Flash on November 17, 2026 for everyday coding tasks such as small fixes, test writing and code explanation. It is generally available in GitHub Copilot, which lists promotional rates of $0.05 per million uncached input tokens and $0.25 per million output tokens. Direct API access through Microsoft Foundry is in limited preview.

By James Carter and Olivia Bennett

What is MAI Code 2 Flash?

MAI Code 2 Flash is the smaller of Microsoft’s two MAI Code 2 models. A good first task is a failing test with a clear error and a narrow set of relevant files. Flash can help explain the failure, propose a patch and rerun the test when the coding client gives it terminal access. Microsoft positions the larger MAI Code 2 for changes that require deeper debugging or coordination across files.

SpecificationMAI Code 2 FlashMAI Code 2
Active parameters12 billion80 billion
Model context window1,050,000 tokens1,050,000 tokens
Model input limit922,000 tokens922,000 tokens
Model output limit128,000 tokens128,000 tokens
ModalitiesText and image in, text outText and image in, text out

Specifications come from Microsoft’s November 17 model card. GitHub documents the roughly one-million-token context option in Visual Studio Code and Copilot CLI. The model card describes the model’s limits, and client settings govern the context you can actually use.

Image input is useful when a visual bug is easier to show than describe. In a client that accepts attachments, give Flash a screenshot, name the affected component and specify the expected behavior. It can propose a CSS change for an overflowing dialog, for instance. A focused screenshot and the relevant component files usually give the model a clearer starting point than a whole-repository prompt.

How does Flash compare with MAI Code 2?

In Microsoft’s evaluation, MAI Code 2 led Flash by 13.3 percentage points on DeepSWE 1.1 and 6.3 points on Terminal-Bench 2.1. Flash was 1.7 points ahead on SWE Atlas. The first test grades repository fixes with hidden tests, the second checks completed terminal tasks, and SWE Atlas includes workloads such as codebase Q&A and test writing.

Coding benchmark pass rates

MAI Code 2 Flash and MAI Code 2

DeepSWE 1.1

Flash 59.9%
Code 2 73.2%

Terminal-Bench 2.1

Flash 78.3%
Code 2 84.6%

SWE Atlas

Flash 44.8%
Code 2 43.1%
Microsoft’s model card reports results at maximum reasoning effort, using GitHub Copilot CLI 1.0.102 with subagents disabled. The scores average three independent attempts per task. Each bar uses a 0% to 100% scale.

For small edits, start with the reasoning setting you plan to use every day. If you also try maximum effort, record its token use and completion time separately. The chart measures pass rate at one setting, so it cannot tell you how quickly a patch will be ready to review in your repository.

How much does MAI Code 2 Flash cost in Copilot?

GitHub’s usage-based Copilot rates make Flash one-tenth the price of MAI Code 2 for the same uncached input and output token counts. For cached input, Flash costs one-fifth as much. GitHub lists a price increase for both models starting May 17, 2027.

Model and rate periodInputCached inputOutput
Flash · Promotional$0.05$0.005$0.25
Flash · From May 17, 2027$0.10$0.010$0.50
Code 2 · Promotional$0.50$0.025$2.50
Code 2 · From May 17, 2027$1.00$0.050$5.00

GitHub Copilot token rates in USD per million tokens. Eligible legacy annual plans may use request multipliers. For Foundry API budgeting, use the rate shown for your deployment.

Worked example. For 1,000 attempts that each use 10,000 uncached input tokens and 2,000 output tokens, Flash costs $1 in token usage at Copilot’s promotional rates. The same token counts cost $10 on Code 2. At the rates scheduled for May 17, 2027, those totals become $2 and $20. The example assumes equal token use and counts token charges only.

If a Flash run needs a second pass, count both attempts. For team budgeting, divide total spending by the number of patches reviewers would merge. Log reviewer time alongside that figure. A cheap patch that sends a reviewer hunting for missed edits can cost more to ship than the first token bill suggests.

How do you use Flash in Copilot or through an API?

GitHub Copilot

On a plan eligible for manual model selection, open the model picker in a supported client such as VS Code or Copilot CLI and choose MAI Code 2 Flash. GitHub lists Flash for Free and Student users through automatic model selection. On Business and Enterprise accounts, a model policy can control access. If Flash is missing from a paid account’s picker, check the client version and the organization’s policy.

Microsoft Foundry

Foundry is the route for calling Flash from your own application. Microsoft describes access as a limited preview. Once your project has access, create a deployment and use its OpenAI-compatible Responses API endpoint. The value of model is your deployment name. Use the OpenAI v1 base URL for the resource that hosts that deployment.

This Python example assumes the openai package is installed and uses an Azure resource key. Set the three environment variables from your deployment before running it.

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["FOUNDRY_OPENAI_BASE_URL"],
    api_key=os.environ["FOUNDRY_API_KEY"],
)

response = client.responses.create(
    model=os.environ["FOUNDRY_DEPLOYMENT"],
    input="Write a pytest test for a function that rejects empty input.",
)

print(response.output_text)

Set the base URL to the endpoint ending in /openai/v1/. Use the Azure resource key for that deployment or configure Microsoft Entra authentication. This is a documentation-based example. A live request requires access to the private preview.

When should you start with Flash?

Use Flash when you can describe the expected change in a few sentences and name the test that should pass. Good candidates include writing a regression test for a date parser, updating code to use a renamed argument, or tracing a validation error to the function that raises it. If the change spans multiple services or the failure only appears after several steps, begin with MAI Code 2 and include the dependencies you already know about.

To compare Flash with Code 2 or a model you already use, such as DeepSeek V4.1 Flash, pick ten recent tasks from your own repository. Give each model the same starting commit, instructions, tools and time budget. For each run, record whether the tests pass, whether a reviewer would merge the diff, the time to an accepted patch and the cost across all attempts. Look at small fixes and multi-file changes separately. A single average can hide the very difference you’re trying to measure.

Frequently asked questions

Can I run MAI Code 2 Flash locally?

Microsoft keeps the model weights private and provides hosted inference. Copilot CLI runs on your machine and sends requests to the hosted service.

Does the Foundry API include the Copilot promotional rates?

The rates above come from GitHub Copilot’s pricing documentation. Use your Azure deployment’s pricing and quota to estimate costs for direct API calls.

Where can I use the full context window in GitHub Copilot?

GitHub lists its roughly one-million-token option in Visual Studio Code and Copilot CLI. Start with the files the task needs. Loading more context can increase AI credit usage.