Cloudflare (Workers AI)
Cloudflare Workers AI — edge inference for chat, embeddings, image generation, speech-to-text, and vision.
Overview
Cloudflare Workers AI runs open models on Cloudflare's global edge network, delivering low-latency inference close to users.
Official Website: https://developers.cloudflare.com/workers-ai/ API Documentation: https://developers.cloudflare.com/workers-ai/models/
Key features
- Edge inference — low latency via Cloudflare's global network
- Chat — text generation with popular open models
- Embeddings — text embeddings for semantic search
- Image generation — text-to-image models
- Speech-to-text — audio transcription
- Vision — image understanding
Using Cloudflare with Yunxin
Address Workers AI models by prefixing the model id with the cloudflare slug — cloudflare/<model>. You always call the same Yunxin base URL, https://api.yuhuanstudio.com/v1, with your sk- API key; Yunxin routes the request to Cloudflare Workers AI.
Usage example
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["YUNXIN_API_KEY"],
base_url="https://api.yuhuanstudio.com/v1",
)
response = client.chat.completions.create(
model="cloudflare/model-id",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(response.choices[0].message.content)Available models
List the models currently available for this provider:
curl "https://api.yuhuanstudio.com/v1/models?provider=cloudflare" \
-H "Authorization: Bearer $YUNXIN_API_KEY"Capabilities and pricing are per-model. Use the Models API to discover which Workers AI models are available and what each one supports.
Official resources
How is this guide?