Models fetching issue: models.dev matching fails for providers with a templated API URL (e.g. Cloudflare Workers AI), so no models are discovered
Cloudflare Workers AI use a custom value in a path of the URL, that is the account ID:
"cloudflare-workers-ai": {
"api": "openai-chat",
"url": "https://api.cloudflare.com/client/v4/accounts/<account_id>/ai/v1",
"key": "api_key"
}
Then it seems it does not match API URL of models.dev, since it's templated:
curl -s https://models.dev/api.json | jq '."cloudflare-workers-ai".api'
"https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/ai/v1"
And since it does not match, according to the docs, it seems to try the /models endpoint, that does not exist in this provider:
01:23:18.394 WARN [MODELS] Provider 'cloudflare-workers-ai': /models endpoint returned status 405: {"result":null,"success":false,"errors":[{"code":7001,"message":"GET not supported for requested URI."}],"messages":[]}
One solution would be to fallback to provider id if URL match fails:
curl -s https://models.dev/api.json | jq '."cloudflare-workers-ai".id'
"cloudflare-workers-ai"
Another could be treating the template part ${...} as wildcards when matching, so it would be ignored.
Then it would match the correct entry of models.dev.
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
thanks, fixing this