Skip to main content
ElevenLabs Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Cloudflare Workers AI

Connect an agent to a custom LLM on Cloudflare Workers AI.

Cloudflare’s Workers AI platform lets you run machine learning models, powered by serverless GPUs, on Cloudflare’s global network, even on the free plan!

Workers AI comes with a curated set of popular open-source models that enable you to do tasks such as image classification, text generation, object detection and more.

To make use of the full power of ElevenLabs Agents you need to use a model that supports function calling.

When browsing the model catalog, look for models with the function calling property beside it.

https://www.youtube-nocookie.com/embed/8iwPIdzTwAA?rel=0

  1. Navigate to dash.cloudflare.com and create or sign in to your account. In the navigation, select AI > Workers AI, and then click on the “Use REST API” widget.

    Add Secret
  2. Once you have your API key, you can try it out immediately with a curl request. Cloudflare provides an OpenAI-compatible API endpoint making this very convenient. At this point make a note of the model and the full endpoint — including the account ID. For example: https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}c/ai/v1/.

    Bash
    curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/chat/completions \
    -X POST \
    -H "Authorization: Bearer {API_TOKEN}" \
    -d '{
        "model": "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
        "messages": [
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "How many Rs in the word Strawberry?"}
        ],
        "stream": false
      }'
  3. Navigate to your AI Agent, scroll down to the “Secrets” section and select “Add Secret”. After adding the secret, make sure to hit “Save” to make the secret available to your agent.

    Add Secret
  4. Choose “Custom LLM” from the dropdown menu.

    Choose custom llm
  5. For the Server URL, specify Cloudflare’s OpenAI-compatible API endpoint: https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/. For the Model ID, specify @cf/deepseek-ai/deepseek-r1-distill-qwen-32b as discussed above, and select your API key from the dropdown menu.

    Enter url
  6. Now you can go ahead and click “Test AI Agent” to chat with your custom DeepSeek R1 model.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu