AI & DevelopmentCloud & DevOps

DeepSeek V4 on Cloudflare Workers AI: 1M Context Window Is Live

DeepSeek V4 Pro and Flash models on Cloudflare Workers AI with 1 million token context window
DeepSeek V4 Flash and Pro arrive on Workers AI with the first 1M-token context window on the platform

On August 14, Cloudflare added DeepSeek V4 Pro and DeepSeek V4 Flash to Workers AI — both with a 1,048,576-token context window. That is the first time any model on Workers AI has shipped with a 1 million token context. If you have been routing long-context inference tasks out of your Workers to external APIs because the old ceiling broke your architecture, you no longer need to.

What Shipped

Two model IDs are live: @cf/deepseek-ai/deepseek-v4-pro-0813 and @cf/deepseek-ai/deepseek-v4-flash-0731. Both run on Cloudflare’s managed GPU network and support the same three access paths: the Workers AI binding (env.AI.run()), the REST API, and the OpenAI-compatible chat completions endpoint. Both also support thinking mode and function calling.

Workers AI’s previous context ceiling was 128K tokens on the best available models. V4 Flash and Pro represent an 8x jump minimum — and the official Cloudflare changelog confirms these are the first models on the platform to cross the 1M mark. That is not an incremental upgrade. It changes what you can fit into a single inference call.

Flash vs Pro: Pick Flash First

The two models are not equals, but the gap is narrower than the naming implies. Flash (284B total parameters, 13B active) outputs at 103.2 tokens per second and scores 47 on the Artificial Analysis Intelligence Index. Pro (1.6T total, 49B active) scores 52 — a 5-point gap. Pro also costs roughly 3.1x more per output token.

In most production workloads, that 5-point intelligence difference does not show up. Use Flash as your default. Reserve Pro for workflows with 10+ tool call chains, multi-agent planning where the coordinator needs to track complex state, or explicitly hallucination-sensitive pipelines where the quality gap actually matters. Paying 3x for the Pro label on a straightforward RAG pipeline is a waste.

Flash 0731Pro 0813
Active params13B49B
Context1M tokens1M tokens
Output speed103.2 tok/sSlower
Intelligence Index4752
Relative cost~3.1x cheaperBaseline
Best forProduction defaultComplex agents

How to Wire It Up

The Workers binding requires two things: add [ai] binding = "AI" to your wrangler.toml, then call the model in your handler. The Workers Wrangler setup guide covers the full configuration.

export default {
  async fetch(request: Request, env: { AI: Ai }): Promise<Response> {
    const messages = [
      { role: "user", content: "Your prompt here..." }
    ];
    const response = await env.AI.run(
      "@cf/deepseek-ai/deepseek-v4-flash-0731",
      { messages }
    );
    return Response.json(response);
  }
};

For streaming, add stream: true to the options object and pipe the resulting ReadableStream directly to the response. If you are already using the OpenAI SDK elsewhere, you can point its baseURL at Cloudflare’s OpenAI-compatible endpoint — no code rewrite required.

The Output Ceiling You Need to Know About

The 1M token context is for input plus output combined. The maximum generated output is 384,000 tokens, but that output must fit within the same 1M window alongside your prompt. Feed in 800K tokens of context and your maximum output drops to roughly 248K tokens. This is not a surprise gotcha — it is how transformer architectures work — but it is worth planning around before you design a workflow that assumes 384K output tokens regardless of input size.

Also worth noting: thinking mode tokens count against your context and your billing even when they are not surfaced to the user. If you enable reasoning mode for a simple classification task, you are burning tokens you did not need to burn.

Pricing and Access

Both models require either the Workers Paid plan or prepaid AI Gateway credits. The free tier gets nothing here. Standard Workers Paid billing gives you a 20-request-per-minute rate limit. If you route through AI Gateway using Unified Billing — which launched August 7, a week before these models dropped — the rate limit jumps to 50 RPM. Cloudflare passes through inference pricing at cost with no markup. The Unified Billing credits carry a 5% fee on purchase, but the per-token rates are identical to calling DeepSeek directly.

The Architecture Unlock

Before V4, building a long-context agentic workflow on Workers meant one of two things: artificially chunk your context and accept worse results, or break out to an external API and accept egress costs and latency spikes. Neither is a clean solution.

With V4, the coordinator-worker pattern becomes practical entirely within Workers AI. A single V4 Pro coordinator holds the full task plan in its 1M context, delegates subtasks to multiple V4 Flash workers for high-speed execution, and reviews combined output — without a single external inference call. The entire loop stays on Cloudflare’s network.

This is the change that matters. The 1M token number is headline material, but the real value is removing the architectural compromise that forced developers off the platform for long-context workloads. Check the Flash model docs and the Pro model docs for the full parameter reference. Start with Flash, measure whether the Pro intelligence gap matters for your specific pipeline, and keep the inference on the edge where it belongs.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *