Joel Stevick

Chapter 5 · section 2 of 7

The provider

The embedding model is @cf/baai/bge-m3, served by Cloudflare’s Workers AI, and the reader’s version calls it over Cloudflare’s REST API with two environment variables:

export CLOUDFLARE_ACCOUNT_ID="..."
export CLOUDFLARE_API_TOKEN="..."

The account ID is on the dashboard’s overview page; the token is created under API Tokens with the Workers AI permission. Without them the stage does not exist, and workersAiEmbedder() returns undefined, which the pipeline in Chapter 10 reads as “retrieve by words alone”. If you would rather not open a second account, skip the two exports; the pipeline runs without them.