For Workes & Pages, what is the name of the domain?
What is the error number?
403
What is the error message?
b’{“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}\n’
What is the issue or error you’re encountering
I am trying to access the cloudflare AI model from python getting the access denied
What are the steps to reproduce the issue?
have this code in the python file.
import asyncio
from cloudflareai import (
CloudflareAI,
AiTextToImageModels,
AiTextGenerationModels,
)
async def main():
ai = CloudflareAI(
Cloudflare_API_Key=<Cloudflare_API_Key>,
Cloudflare_Account_Identifier=<Cloudflare_Account_Identifier>,
)
text = await ai.TextGeneration(
user_prompt="You are helpful",
system_prompt="Hello, my name is Alex",
model_name=AiTextGenerationModels.CODE_LLAMA_7B,
)
print(text.text) # returns string
print(text.status_code)
asyncio.run(main())
intall the python packages “asyncio”, :cloudflareai
run the code using
python filename.py