JuliusBrussee/caveman · error
azure bearer credentials are unsupported; use an API key
Error message
azure bearer credentials are unsupported; use an API key
What it means
An Azure OpenAI credential arrived with bearer scheme but is not the synthetic no-key-required placeholder; the gateway only supports API-key auth for Azure, so the bearer token must not be forwarded as Authorization.
Solutions
- Configure an Azure API key credential instead of an Entra bearer token
- If the placeholder marker was intended, verify the standalone env fallback path set the scheme correctly
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at proxy/providers/adapter.go:504 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-08-18).
Data as JSON: /api/errors/e7d6148918d8372a.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/providers/adapter.go:508
out.Set("authorization", "Bearer "+credential.Key)
}
copyIfPresent(out, req.Header, "x-vertex-ai-llm-request-type")
copyIfPresent(out, req.Header, "x-goog-user-project")
case "azure_openai":
if credential.Key != "" {
// The standalone placeholder is a synthetic no-key marker used by
// callers that explicitly allow env-backed API-key fallback. It is
// not an Entra token and must not be forwarded as Authorization;
// gateway fallback may replace it with the Azure api-key header.
if credential.Scheme == "bearer" && credential.Key == "no-key-required" {
break
}
// Real bearer/JWT credentials remain fail-closed until an auth-kind is
// persisted and mapped end-to-end. They must never be silently
// relabeled as an api-key.
fields := strings.Fields(strings.TrimSpace(credential.Key))
if credential.Scheme == "bearer" || len(fields) > 1 && strings.EqualFold(fields[0], "bearer") || strings.HasPrefix(strings.TrimSpace(credential.Key), "eyJ") {
return nil, fmt.Errorf("azure bearer credentials are unsupported; use an API key")
}
out.Set("api-key", credential.Key)
}
default:
if credential.Key != "" {
out.Set("authorization", "Bearer "+credential.Key)
}
}
return out, nil
}
func validGoogleQuotaProject(value string) bool {
if value == "" || len(value) > 128 {
return false
}
for _, r := range value {
if r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' || r >= '0' && r <= '9' || r == '-' || r == '.' || r == '_' || r == ':' {
continueView on GitHub (pinned to 5184b3d11a)