{"slug": "kimi-k2-7-code-is-now-available-in-microsoft-foundry", "title": "Kimi K2.7 Code is Now Available in Microsoft Foundry", "summary": "Microsoft and Moonshot AI have made the Kimi K2.7 Code model available in the Microsoft Foundry model catalog starting July 1, 2026. The coding-focused model, priced at $0.95 input and $4.00 output per million tokens, features a 256K context window and shows competitive performance on agentic coding benchmarks, including beating Claude Opus 4.8 on MCP Mark Verified. A developer provided a .NET console app example using the Azure AI Inference SDK to call the model.", "body_md": "There are a lot of AI model announcements these days. But every now and then one lands that feels immediately practical for real engineering work.\n\nKimi K2.7 Code from Moonshot AI showing up in Microsoft Foundry feels like one of those releases.\n\nMicrosoft and Moonshot AI have made Kimi K2.7 Code available in the Foundry model catalog starting July 1, 2026. It is designed for the kind of software engineering that does not happen in a single prompt — multi-file refactors, feature work spanning multiple services, debugging sessions that need to hold context across many steps.\n\nThat is a different problem space from \"generate a todo app in one shot.\" And honestly, that is where most development teams are today.\n\nKimi K2.7 Code is a coding-focused model from Moonshot AI. It builds on the K2.6 series with three focused improvements:\n\nThe 256K context window is the other number worth noting. Large codebases, long refactoring sessions, multiple files in context at once — that is the use case this model is optimized for.\n\nHere is how K2.7 Code stacks up against K2.6 and two frontier models:\n\n| Benchmark | Kimi K2.6 | Kimi K2.7 Code |\nGPT-5.5 | Claude Opus 4.8 |\n|---|---|---|---|---|\n| Kimi Code Bench v2 | 50.9 | 62.0 |\n69.0 | 67.4 |\n| Program Bench | 48.3 | 53.6 |\n69.1 | 63.8 |\n| MLS Bench Lite | 26.7 | 35.1 |\n35.5 | 42.8 |\n| MCP Atlas | 69.4 | 76.0 |\n79.4 | 81.3 |\nMCP Mark Verified |\n72.8 | 81.1 |\n92.9 | 76.4 |\n\nA few things worth flagging:\n\nThe Kimi Code Bench numbers are Moonshot AI's own benchmark — take those as directional. MCP Mark Verified is human-verified and more credible for independent comparison. On that benchmark, K2.7 Code at **81.1** actually beats Claude Opus 4.8 at 76.4. That is the benchmark most relevant to agentic coding workflows with tool use.\n\nOn pure coding tasks (Program Bench, MLS Bench Lite), it sits between GPT-5.5 and Claude Opus 4.8. That is a reasonable position for a model priced at $0.95 input / $4.00 output per million tokens.\n\n| Input / 1M tokens | Output / 1M tokens | Cached Input | |\n|---|---|---|---|\n| Kimi K2.7 Code | $0.95 | $4.00 | $0.19 |\n\nAt $0.95 input, this sits below GPT-4o-class pricing. For long-running coding tasks that consume a lot of output tokens, $4.00/M output is the number to watch. Cached input at $0.19 helps when you are repeatedly loading the same large codebase context.\n\nIf you are evaluating this model, here is where it fits:\n\nThat is a pretty specific profile. This is not a general-purpose chatbot. It is a model built for developer tooling and autonomous coding agents.\n\nHere is a working .NET console app that calls Kimi K2.7 Code through Azure AI Foundry. I am using the Azure AI Inference SDK and DefaultAzureCredential — no API key hardcoded.\n\nCode also located at (Github|[https://github.com/taswar/KimiFoundryDemo](https://github.com/taswar/KimiFoundryDemo))\n\n```\ndotnet new console -n KimiFoundryDemo\ncd KimiFoundryDemo\ndotnet add package Azure.AI.Inference --prerelease\ndotnet add package Azure.Identity\n```\n\nSet your environment variables:\n\n```\n# On Windows (PowerShell)\n$env:AZURE_AI_CHAT_ENDPOINT=\"https://YOURRESOURCE.services.ai.azure.com/models\"\naz login\n$env:AZURE_AI_MODEL = \"kimi-k2-7-code\"\nusing Azure.Identity;\nusing Azure;\nusing Azure.AI.Inference;\nusing Azure.Core;\n\nvar endpoint = Environment.GetEnvironmentVariable(\"AZURE_AI_CHAT_ENDPOINT\")\n    ?? throw new InvalidOperationException(\"Set AZURE_AI_CHAT_ENDPOINT environment variable.\");\n\nvar model = Environment.GetEnvironmentVariable(\"AZURE_AI_MODEL\") ?? \"Kimi-K2.7-Code\";\n\n// DefaultAzureCredential handles Entra ID auth — no API key in code.\n// Sign in first with: az login\nvar credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions\n{\n    ExcludeManagedIdentityCredential = true\n});\n\n// Foundry (Cognitive Services) endpoints require a token whose audience is\n// https://cognitiveservices.azure.com. Force that scope regardless of the\n// scope the Azure.AI.Inference SDK requests by default.\nvar scopedCredential = new ScopeOverrideCredential(\n    credential, \"https://cognitiveservices.azure.com/.default\");\n\nvar client = new ChatCompletionsClient(new Uri(endpoint), scopedCredential);\n\nvar options = new ChatCompletionsOptions\n{\n    Model = model,\n    Temperature = 0.2f,\n    MaxTokens = 2000\n};\n\noptions.Messages.Add(new ChatRequestSystemMessage(\n    \"\"\"\n    You are a senior .NET architect.\n    Your job is to review code and identify issues clearly and concisely.\n    Be direct. Prioritize correctness over style.\n    Return findings as a numbered list with severity: critical, warning, or info.\n    \"\"\"));\n\noptions.Messages.Add(new ChatRequestUserMessage(\n    \"\"\"\n    Review the following C# method and identify any issues:\n\n    public async Task GetUserAsync(int userId)\n    {\n        var user = await _dbContext.Users\n            .Where(u => u.Id == userId)\n            .FirstOrDefault();\n\n        return user;\n    }\n    \"\"\"));\n\nConsole.WriteLine($\"Calling model: {model}\");\nConsole.WriteLine(\"---\");\n\nResponse<ChatCompletions> response = client.Complete(options);\nSystem.Console.WriteLine(response.Value.Content);\n\n// Wraps a TokenCredential and forces a fixed audience/scope, ignoring the\n// scope the client pipeline asks for.\nsealed class ScopeOverrideCredential : TokenCredential\n{\n    private readonly TokenCredential _inner;\n    private readonly string[] _scopes;\n\n    public ScopeOverrideCredential(TokenCredential inner, string scope)\n    {\n        _inner = inner;\n        _scopes = new[] { scope };\n    }\n\n    public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)\n        => _inner.GetToken(new TokenRequestContext(_scopes), cancellationToken);\n\n    public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)\n        => _inner.GetTokenAsync(new TokenRequestContext(_scopes), cancellationToken);\n}\n```\n\nSomething like:\n\n```\nCalling model: kimi-k2-7-code\n---\n1. **Critical — `Task` return type does not match returned value**  \n   The method returns `user`, but the signature returns non-generic `Task`. Change it to `Task<User?>` (or `Task<User>` if nullability is disabled).\n\n2. **Critical — Synchronous `FirstOrDefault` used in an async method**  \n   `.FirstOrDefault()` executes the query synchronously and is not awaitable. Use `.FirstOrDefaultAsync()` (and pass a `CancellationToken`).\n\n3. **Warning — Missing `CancellationToken`**  \n   Async methods should accept `CancellationToken cancellationToken = default` and forward it to `FirstOrDefaultAsync(cancellationToken)`.\n\n4. **Info — Consider `FindAsync` for primary-key lookups**  \n   Since the query is by primary key, `_dbContext.Users.FindAsync(userId, cancellationToken)` is more idiomatic and can be faster due to EF change-tracker short-circuiting.\n```\n\nThat is the kind of output you want from a code review tool — specific, actionable, severity-tagged.\n\nIf you are already in Azure, Foundry gives you a few things you do not get with a direct Moonshot API key:\n\nThat last point matters more than it sounds. The jump from \"I tried this in a notebook\" to \"this is running in our CI pipeline\" is usually infrastructure, not capability. Foundry removes that friction.\n\nKimi K2.7 Code in Microsoft Foundry is interesting for developers because it is not just a benchmark improvement. It is a model positioned for the kind of work that is genuinely hard to automate well: long-running, multi-step, multi-file engineering tasks.\n\nThe MCP Mark Verified score beating Claude Opus 4.8 is the number I would keep an eye on as agentic coding workflows mature. If your team is building AI-assisted developer tooling or coding agents, this is one worth evaluating.\n\nIf you are already on Azure AI Foundry, the model is in the catalog now. Start with the C# code above, swap in your own endpoint, and run it against a real method from your codebase. That will tell you more than any benchmark.", "url": "https://wpnews.pro/news/kimi-k2-7-code-is-now-available-in-microsoft-foundry", "canonical_source": "https://dev.to/taswar_bhatti/kimi-k27-code-is-now-available-in-microsoft-foundry-l7b", "published_at": "2026-07-31 09:26:32+00:00", "updated_at": "2026-07-31 09:38:29.441087+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "developer-tools"], "entities": ["Microsoft", "Moonshot AI", "Kimi K2.7 Code", "Azure AI Foundry", "Azure AI Inference SDK", "GPT-5.5", "Claude Opus 4.8", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/kimi-k2-7-code-is-now-available-in-microsoft-foundry", "markdown": "https://wpnews.pro/news/kimi-k2-7-code-is-now-available-in-microsoft-foundry.md", "text": "https://wpnews.pro/news/kimi-k2-7-code-is-now-available-in-microsoft-foundry.txt", "jsonld": "https://wpnews.pro/news/kimi-k2-7-code-is-now-available-in-microsoft-foundry.jsonld"}}