feat(azure): support Kimi family (Moonshot) on Azure AI Foundry#650
Merged
Conversation
added 2 commits
April 27, 2026 14:40
Azure AI Foundry now hosts Moonshot's Kimi-K2 family (kimi-k2.5, kimi-k2-thinking, etc.) and the Azure deployment naming sometimes uses uppercase "Kimi-K2.x" while LLMDB-canonical ids are lowercase. Adding both prefixes to @model_families so case-sensitive prefix matching works for either, plus the matching AZURE_KIMI_BASE_URL / AZURE_KIMI_API_KEY family env-var entries. Routes through the existing Azure.OpenAI formatter — Foundry exposes Kimi via the standard OpenAI-compatible /models/chat/completions endpoint, so no new formatter is needed. Without this, any "azure:Kimi-..." (or "azure:kimi-...") model raises ArgumentError "Unknown Azure model family for ..." at request time.
…rning The Kimi family addition in 8d4e14d only covered @model_families and the family env-var maps. The OpenAI formatter (Azure.OpenAI.format_request/3) keeps an independent prefix allowlist (@openai_compatible_prefixes) and emits a Logger.warning every request when the model id falls outside it ("Model 'Kimi-K2.6' does not appear to be OpenAI-compatible. Proceeding with OpenAI formatting (may fail)."), even though the request would have succeeded. Add "Kimi" and "kimi" to the formatter's prefix list to suppress the spurious warning, and cover Kimi end-to-end: * azure:kimi-k2.5 resolves from LLMDB and prepares a request OK. * Kimi-K2.6 (uppercase Azure deployment id, not in LLMDB) prepares OK when constructed as %LLMDB.Model{}. * format_request emits no "does not appear to be OpenAI-compatible" warning for either casing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Azure AI Foundry hosts Moonshot's Kimi-K2 family —
kimi-k2-thinkingandkimi-k2.5are already in LLMDB, and the newerKimi-K2.6is deployable in Azure today. Butlib/req_llm/providers/azure.exdoesn't list a Kimi prefix in@model_families, so anyazure:Kimi-.../azure:kimi-...model crashes atprepare_request/4time:A second symptom: even after stubbing the family map,
Azure.OpenAI.format_request/3keeps an independent prefix allowlist (@openai_compatible_prefixes) and emits aLogger.warningon every Kimi request:The request actually succeeds (Foundry exposes Kimi via the standard OpenAI-compatible
/openai/v1/chat/completionsendpoint), so the warning is misleading.Changes
@model_familiesinlib/req_llm/providers/azure.ex— add"Kimi" => Azure.OpenAIand"kimi" => Azure.OpenAI. Both casings because LLMDB-canonical ids are lowercase (kimi-k2.5,kimi-k2-thinking) but Azure deployment names are commonly uppercased (Kimi-K2.6), andString.starts_with?/2is case-sensitive.@family_env_vars/@family_api_key_env_vars— add matchingAZURE_KIMI_BASE_URL/AZURE_KIMI_API_KEYentries (both casings) for symmetry withdeepseek/mai-ds.@openai_compatible_prefixesinlib/req_llm/providers/azure/openai.ex— same two casings, suppresses the spurious "may fail" warning.describe "Kimi family routing":azure:kimi-k2.5(lowercase, LLMDB-resolved) prepares a request without raising.Kimi-K2.6(uppercase, hand-built%LLMDB.Model{}) prepares a request without raising.format_request/3emits no "does not appear to be OpenAI-compatible" warning for either casing.No new formatter module needed — Foundry's
/openai/v1/chat/completionsis OpenAI-compatible, so reusingAzure.OpenAImatches the existing pattern fordeepseek/mai-ds/grok.Test plan
mix test test/provider/azure/azure_test.exs— 107/107 pass (4 new + 103 existing).References
🤖 Generated with Claude Code