You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
path_template URL-encodes slashes in model name, breaking ai.run() in v5 #2718
fromcloudflareimportCloudflareclient=Cloudflare(api_token="<valid_token>")
# This worked in v4.3.1, fails in v5 with "No route for that URI"result=client.ai.run(
"@cf/black-forest-labs/flux-1-schnell",
account_id="<account_id>",
prompt="a cat sitting on a chair",
)
I also confirmed the encoding without making an API call:
OS: Ubuntu 24 (GitHub Actions runner) — also reproducible locally
Last working version: 4.3.1
Impact
This breaks everyclient.ai.run() call for any model which identifiers contain slashes (e.g. @cf/meta/llama-3.1-8b-instruct, @cf/black-forest-labs/flux-1-schnell, etc.).
Workaround
In the meantime, I am using a workaround based on the REST API directly to bypass the SDK:
importrequestsresponse=requests.post(
f"https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/black-forest-labs/flux-1-schnell",
headers={"Authorization": f"Bearer {api_token}"},
json={"prompt": "a cat sitting on a chair"},
)
data=response.json()
To Reproduce
fromcloudflareimportCloudflareclient=Cloudflare(api_token="<valid_token>")
# This worked in v4.3.1, fails in v5 with "No route for that URI"result=client.ai.run(
"@cf/black-forest-labs/flux-1-schnell",
account_id="<account_id>",
prompt="a cat sitting on a chair",
)
Thank you for submitting an issue! This issue has been flagged for an internal Cloudflare team to take a look. If this is urgently blocking your development or deployment, please open a support case so we can serve you faster.
Activity
KaydeeDee commentedon May 25, 2026
Thank you for submitting an issue! This issue has been flagged for an internal Cloudflare team to take a look. If this is urgently blocking your development or deployment, please open a support case so we can serve you faster.