Cloudflare Workers AI
In this example, we are using Cloudflare Workers AI to generate the keys.
Cloudflare Workers AI is used as an embeddings provider in Discourse AI (e.g., for semantic search and RAG). It is not used as an LLM provider.
Note: Workers AI is available on both Free and Paid Cloudflare plans. Usage-based pricing may apply. See here for up-to-date details.
Platforms will always change so this guide may not reflect 100% process.
Generate the API key
- Log in to Cloudflare. Follow the instructions in their documentation to get an API key and the Account ID
- Generate the API Key and note the Account ID
- Once the key is generated, store it in a safe and secure place and copy it
Using API key for Discourse AI
Cloudflare Workers AI credentials are now configured through the AI Secrets and AI Embeddings admin pages, not through plugin site settings.
- Go to Admin → Plugins → Discourse AI → AI Secrets (
/admin/plugins/discourse-ai/ai-secrets) - Create a new secret with your Cloudflare API token
- Go to Admin → Plugins → Discourse AI → AI Embeddings (
/admin/plugins/discourse-ai/ai-embeddings) - Create or edit an embedding definition, selecting Cloudflare as the provider
- Set the URL to your Cloudflare Workers AI endpoint, which includes your Account ID, e.g.:
https://api.cloudflare.com/client/v4/accounts/YOUR_ACCOUNT_ID/ai/run/@cf/baai/bge-large-en-v1.5 - Select the AI Secret you created in step 2
The old site settings
ai_cloudflare_workers_api_tokenandai_cloudflare_workers_account_idare now hidden and deprecated. Existing configurations were automatically migrated to the new Embedding Definitions and AI Secrets system.
Last edited by @hugh 2024-05-29T06:10:50Z
Check document
Perform check on document: