JuliusBrussee/caveman · error
azure Foundry api-version
Error message
azure Foundry api-version %q is not supported
What it means
The Azure OpenAI adapter only accepts the Foundry Models v1 inference route with api-version=v1 or api-version=preview. A request to /openai/v1/chat/completions or /openai/v1/responses carrying any other api-version value is rejected before reaching upstream. This pins Foundry v1 requests to the two documented version strings instead of date-style api-versions.
Solutions
- Set api-version=v1 (or api-version=preview) in the query string of Foundry v1 route requests.
- Remove the api-version query parameter entirely — the Foundry v1 route allows it to be absent.
- If a date-style version is required, use the legacy deployment route /azure/openai/deployments/{deployment}/chat/completions instead, where the allowlist applies.
Example fix
// before GET /azure/openai/v1/chat/completions?api-version=2024-10-21 // after GET /azure/openai/v1/chat/completions?api-version=v1
Defensive patterns
Strategy: validation
Validate before calling
func foundryVersionOK(rawURL string) bool {
u, err := url.Parse(rawURL)
if err != nil {
return false
}
p := strings.TrimPrefix(u.Path, "/azure")
if p != "/openai/v1/chat/completions" && p != "/openai/v1/responses" {
return true
}
vs := u.Query()["api-version"]
return len(vs) <= 1 && (len(vs) == 0 || vs[0] == "v1" || vs[0] == "preview")
} Prevention
- Never attach date-style api-version values to Foundry v1 route URLs.
- Build query strings with url.Values so parameters cannot silently duplicate or carry stale values.
- Keep one canonical client constant for the v1 api-version ("v1" or "preview").
When it happens
Trigger: A request to the Foundry v1 route (/azure/openai/v1/chat/completions or /azure/openai/v1/responses) whose query string contains exactly one api-version parameter whose value is neither "v1" nor "preview", e.g. ?api-version=2024-10-21.
Common situations: Clients that reuse the date-style api-version from legacy deployment URLs on the new Foundry v1 endpoint; SDK version switches that emit a pinned date version; copy-pasting an example URL from legacy Azure docs into a v1 route.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- azure legacy inference path
- azure request missing api-version
- azure api-version is not on the allowlist
- azure request has duplicate api-version values
- bedrock request path
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/fbf7d3cb2ec2aa3f.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/providers/azureopenai/azure_routing.go:45
}
// ResolveUpstreamURL validates either the legacy deployment route or the
// current Foundry Models v1 inference route before resolving upstream.
func (a Adapter) ResolveUpstreamURL(ctx context.Context, req *http.Request, route providers.RouteContext) (*url.URL, error) {
if err := validateAzureRequest(req.URL); err != nil {
return nil, err
}
return a.Base.ResolveUpstreamURL(ctx, req, route)
}
func validateAzureRequest(u *url.URL) error {
if foundryV1InferenceRoute(u.Path) {
versions := u.Query()["api-version"]
if len(versions) > 1 {
return fmt.Errorf("azure request has duplicate api-version values")
}
if len(versions) == 1 && versions[0] != "v1" && versions[0] != "preview" {
return fmt.Errorf("azure Foundry api-version %q is not supported", versions[0])
}
return nil
}
if !legacyChatCompletionsRoute(u.Path) {
return fmt.Errorf("azure legacy inference path %q is not supported", u.Path)
}
versions := u.Query()["api-version"]
if len(versions) > 1 {
return fmt.Errorf("azure request has duplicate api-version values")
}
version := ""
if len(versions) == 1 {
version = versions[0]
}
if version == "" {
return fmt.Errorf("azure request missing api-version")
}
if !apiVersionAllowed(version) {View on GitHub (pinned to 3ee70a1026)