🚀 Cloudflare AI Model Tester

A simple worker for testing Cloudflare's AI models with open source LLMs.

📡 Endpoints

GET /models

Get information about supported models and usage examples.

POST /chat

Chat with AI models. Send JSON with:

💡 Example Usage

Using curl:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "model": "@cf/meta/llama-3.1-8b-instruct",
    "messages": [
      {"role": "user", "content": "Hello! Tell me about yourself."}
    ],
    "max_tokens": 100
  }' \
  https://your-worker.your-subdomain.workers.dev/chat

JavaScript fetch:

fetch('/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: '@cf/microsoft/phi-2',
    messages: [
      { role: 'user', content: 'Explain quantum computing in simple terms' }
    ],
    max_tokens: 200
  })
}).then(r => r.json()).then(console.log);

💰 Free Tier Tips

🔗 View Available Models