Llama 2 writes poetry on Workers AI
Cloudflare’s co-founders, Matthew and Michelle, published their annual founders’ letter today, closing with a poem generated by an AI model running on Workers AI across Cloudflare’s global network. The poem was written by Meta’s Llama 2 model — 7B parameters with 8-bit integers — using just 14 lines of code. No dedicated GPU infrastructure, no complex orchestration: the model runs directly on the edge.
From code to verse
The deployment process is straightforward. Once the worker is live, interacting with the model requires nothing more than a request. The sample output below — with the domain name redacted — shows a range of poetic styles, from optimistic reflections on global connectivity to darker meditations on digital freedom and privacy.
import { Ai } from "@cloudflare/ai";
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const body = await request.json();
const ai = new Ai(env.AI);
const response = await ai.run("@cf/meta/llama-2-7b-chat-int8", body);
return new Response(JSON.stringify(response));
},
};
export interface Env {
AI: any;
}
One take on the connectivity cloud is unambiguously positive, tying the technology to themes of unity and progress:
% curl -X POST https://example.com/ -d '{"prompt":"Write a poem \
that talks about the connectivity cloud"}' | jq -r .response
Another response offers a more balanced view, contrasting the connectivity cloud with what it calls the “captivity cloud” — a metaphor for constrained access and lost freedom:
% curl -X POST https://example.com/ -d '{"prompt":"Write a poem \
that talks about the connectivity cloud and contrast it with the \
captivity cloud"}' | jq -r .response
A third attempt adopts an older, more formal register, with “doth” constructions and a strong emotional arc:
% curl -X POST https://example.com/ -d '{"prompt":"Write a poem \
that talks about the connectivity cloud and contrast it with the \
captivity cloud using Elizabethan English"}' | jq -r .response
A final generation frames the question as a digital divide between openness and security, suggesting both are necessary:
% curl -X POST https://example.com/ -d '{"prompt":"Write a poem \
that talks about the connectivity cloud and contrast it with the \
captivity cloud in the style of Lord Byron"}' | jq -r .response
Ready to build
The examples above were produced by simply asking the model for poems. The infrastructure, however, is the more interesting part: a serverless deployment on Workers AI was enough to run Llama 2 meaningfully — no dedicated ML platform or GPU provisioning required. The full Workers AI announcement details how to deploy this kind of workload from idea to production in minutes.



