Cloudflare Workers AI
Run open AI models (Llama, Mistral, Gemma, Qwen, embeddings) on Cloudflare's global network. OpenAI-compatible chat completions and embeddings.
setup_integration or the Dashboard Vault — they're encrypted
with AES-256-GCM and never exposed.
Required Credentials
Get your API key at developers.cloudflare.com →
Endpoints (3)
Send a conversation to a Workers AI text model and get the response. OpenAI-compatible format.
| Field | Type | Required | Description |
|---|---|---|---|
model |
string | ✓ Yes | Workers AI model id, e.g. "@cf/meta/llama-3.1-8b-instruct", "@cf/mistral/mistral-7b-instruct-v0.1". Use list-models to find more. |
messages |
array | ✓ Yes | Conversation messages. Example: [{"role": "user", "content": "Hello"}]. OpenAI format. |
max_tokens |
integer | No | Max response tokens. |
temperature |
number | No | Sampling temperature. |
Create text embeddings with a Workers AI embedding model. OpenAI-compatible format.
| Field | Type | Required | Description |
|---|---|---|---|
model |
string | ✓ Yes | Embedding model id, e.g. "@cf/baai/bge-base-en-v1.5" or "@cf/baai/bge-m3" (multilingual). |
input |
string|array | ✓ Yes | Text to embed: one string or an array of strings. |
Search the Workers AI model catalog. Filter by task (e.g. "Text Generation") or search term.
| Field | Type | Required | Description |
|---|---|---|---|
search |
string | No | Search term, e.g. "llama". |
task |
string | No | Task name, e.g. "Text Generation", "Text Embeddings", "Text-to-Image". |
page |
integer | No | Page number (default 1). |
per_page |
integer | No | Results per page. |
MCP Tool Names
When using this integration through an AI assistant (Claude, ChatGPT, Cursor, etc.), the endpoints are available as MCP tools:
| Endpoint | MCP Tool Name |
|---|---|
| chat-completion | cloudflare-workers-ai_chat_completion |
| embeddings | cloudflare-workers-ai_embeddings |
| list-models | cloudflare-workers-ai_list_models |
Website