Skip to content

Log flooded with repeated 'Provider model discovery failed with HTTP 404' for anthropic-adapter providers without /v1/models (Azure AI Foundry) #395

Description

@DiNaSoR

Summary

When a custom provider uses adapter: "anthropic" with a base URL that does not implement the Anthropic model-listing endpoint (e.g. Azure AI Foundry's Anthropic-compatible endpoint), the proxy log is flooded with this warning on every catalog poll:

[opencodex] Provider model discovery for "azure-foundry-anthropic" failed with HTTP 404 [urlClass=provider-models, fallback=configured].

The warning repeats dozens of times per session (the dashboard/Codex polls the catalog frequently, and each poll after the discovery cache/cooldown expires re-probes and re-logs), drowning out useful log output.

Environment

  • opencodex @bitkyc08/opencodex 0.144.5 (Windows 11, Node via scoop/nvm)
  • Provider config:
"azure-foundry-anthropic": {
  "adapter": "anthropic",
  "baseUrl": "https://<resource>.services.ai.azure.com/anthropic",
  "models": ["claude-haiku-4-5", "claude-opus-4-8[1m]", "claude-sonnet-5[1m]", "claude-fable-5[1m]"],
  // ...
}

Root cause

buildModelsRequest() (src/oauth/index.ts) probes GET {baseUrl}/v1/models?limit=1000 for every adapter: "anthropic" provider.

Azure AI Foundry's Anthropic endpoint only implements the inference route, not the models-list route. Verified directly against the endpoint:

  • GET /anthropic/v1/models404
  • POST /anthropic/v1/messages200

So discovery can never succeed for this provider class; the 404 → fallback=configured path in src/codex/catalog/provider-fetch.ts works correctly (the configured static models list is served and inference is unaffected), but the warning is re-emitted forever.

Workaround

Setting "liveModels": false on the provider skips discovery entirely and silences the log. This works, but users have to discover the flag after the fact.

Suggested fixes (any of these would help)

  1. Log once per provider per process (or once per cooldown window) instead of on every failed probe — e.g. demote repeats to debug level after the first warning.
  2. Remember a "discovery unsupported" verdict: after N consecutive 404s on urlClass=provider-models, treat the provider as liveModels: false for the rest of the session (keep the configured/static list) and log a single informative line suggesting the config flag.
  3. Optionally, have the Azure Foundry preset/docs set liveModels: false by default, since the endpoint is known not to implement /v1/models.

Happy to provide more logs if useful. Thanks for the project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions