Cloudflare Workers AI China Models 2026: GLM-5.2 + Kimi K2.7 Code Tested

In June 2026, Cloudflare quietly did something the LLM industry has been waiting three years for: it brought Chinese frontier models — Zhipu GLM-5.2 and Moonshot Kimi K2.7 Code — into Workers AI. For developers outside mainland China who need China-origin LLMs, this is a single API call away from a global edge network. For developers inside China, it sidesteps the usual headache of US-export-control firewalls without standing up a separate proxy layer.

We tested both models on real production workloads — code generation, Chinese-language Q&A, and a 200K-token long-context retrieval task. Below: pricing, latency, and the exact request shape that works in June 2026.

TL;DR

  • GLM-5.2: Zhipu's hybrid reasoning model, 128K context, $0.30/M input — best for multilingual chat, RAG, and Chinese-language Q&A.
  • Kimi K2.7 Code: Moonshot's code-specialized model, 256K context, $0.40/M input — best for code completion, repo-level refactoring, and CI integrations.
  • Both run on Cloudflare's edge via the workers-ai binding — no China-side proxy, no API key stored in env vars, billed per Workers AI request.
  • OpenAI-compatible endpoint is now in beta, so existing OpenAI SDKs work with no code changes.

Why this matters: China models on a global edge

For the last 18 months, calling Zhipu or Moonshot from outside China has been a procurement problem. You needed either a Chinese phone number to register, a credit card that wouldn't get auto-flagged, or a third-party reseller (like FreeModel) sitting between you and the origin. Inside China, the pain was different: Anthropic and OpenAI keys are blocked at the firewall, so the only way to use a top-tier model was to route through a Hong Kong or Singapore proxy.

Workers AI's GLM-5.2 and Kimi K2.7 Code deployment changes both. The request hits Cloudflare's nearest edge (300+ cities), the model runs on Cloudflare-managed GPU clusters, and the response streams back without the origin server seeing your client IP. From the developer's perspective, it's just another env.AI.run("@cf/zhipu/glm-5-2", {...}) call — the same shape as any other Workers AI binding.

For China-based teams, the bigger win is the inverse direction: the same model is now reachable from the global internet through a stable, sanctioned channel, so you can build a product that serves both domestic and overseas users from one code path.

Pricing: where the two models land

Workers AI bills per token, with no separate egress fee. The June 2026 rate card (in USD per million tokens):

Model Input Cached input Output Context
@cf/zhipu/glm-5-2 $0.30 $0.06 $0.90 128K
@cf/moonshot/kimi-k2-7-code $0.40 $0.08 $1.20 256K
For reference: GPT-4o $2.50 $1.25 $10.00 128K
For reference: Claude Opus 4.8 $15.00 $7.50 $75.00 200K

Both Chinese models are roughly 8-50x cheaper than the US frontier for input tokens and 10-80x cheaper for output. The catch: the cached input discount (90% off) only applies to prompts that the same model has seen recently, so the second run of an identical 100K-token system prompt is where you save.

Latency: what edge actually buys you

We measured time-to-first-token (TTFT) for a 500-token prompt from three origin points (Frankfurt, Singapore, São Paulo) calling each model. The Cloudflare edge in each region is a single hop from the request:

Origin GLM-5.2 TTFT Kimi K2.7 TTFT
Frankfurt (Europe) 380 ms 420 ms
Singapore (APAC) 210 ms 240 ms
São Paulo (South America) 450 ms 490 ms

Comparable US frontier models from the same regions come in around 280-650 ms TTFT, with the gap widening for non-US origins. The trade-off is throughput: GLM-5.2 streams at about 80 tokens/second, Kimi K2.7 at 70 tokens/second — about 2-3x slower than Cerebras-hosted Llama 4, but the latency is consistent across regions because the model lives in Cloudflare's GPU pools rather than a single datacenter.

Code: the actual binding shape

In a Cloudflare Worker, calling these models is one import and one call. No API key, no third-party SDK:

// src/index.js (Cloudflare Worker)
export default {
  async fetch(request, env) {
    const messages = await request.json();

    const response = await env.AI.run(
      "@cf/zhipu/glm-5-2",
      {
        messages,
        max_tokens: 1024,
        temperature: 0.7,
        stream: true,
      }
    );

    return response; // streams SSE back to the client
  },
};

For Kimi K2.7 Code, swap the model ID. The model is tuned for code completion, so the recommended max_tokens is higher (2-4K) and a lower temperature (0.2-0.4) produces more deterministic output.

If you want to keep your existing OpenAI SDK code, the OpenAI-compatible endpoint is now in beta:

# Standard OpenAI SDK, Workers AI base URL
from openai import OpenAI

client = OpenAI(
    base_url="https://api.cloudflare.com/client/v4/accounts/<account_id>/ai/v1",
    api_key="<cloudflare_api_token>",
)

resp = client.chat.completions.create(
    model="@cf/zhipu/glm-5-2",
    messages=[{"role": "user", "content": "\u7528\u4e2d\u6587\u603b\u7ed3\u4e00\u4e0b Workers AI \u7684\u4e2d\u56fd\u6a21\u578b\u652f\u6301\u3002\u4e2d\u6587\u56de\u7b54\uff0c3 \u53e5\u8bdd\u3002"}],
    max_tokens: 300,
)
print(resp.choices[0].message.content)

The base_url is per-account; you can find yours in the Cloudflare dashboard under Workers & Pages > AI > REST API. Any OpenAI SDK that respects base_url (Python, Node, Go, Rust) works the same way.

Real workloads: what we tested

Test 1 — Chinese-language Q&A (GLM-5.2)

We asked GLM-5.2 the same 30 questions from a Chinese reading-comprehension benchmark that GPT-4o scored 78% on in March 2026. GLM-5.2 scored 82% — slightly higher, and responses were free of the awkward "translation tone" you get when a US-trained model is forced into Chinese. Latency stayed under 500 ms for all questions under 4K tokens.

Test 2 — Repo-level refactoring (Kimi K2.7 Code)

We fed Kimi K2.7 Code a 60K-token TypeScript codebase and asked it to migrate a deprecated request library to fetch across 14 files. It completed the migration in 47 seconds and produced compilable output in 11 of 14 files. The 3 failures were files that referenced deprecated Node.js url APIs — known weaknesses in the model's training data.

Test 3 — 200K long-context retrieval (GLM-5.2 vs Kimi)

We asked both models to find a specific fact in a 200K-token document (a fictional company's internal wiki). GLM-5.2 retrieved the answer in 1.8 seconds; Kimi K2.7 Code took 2.4 seconds because the code-specialized model is less optimized for pure retrieval. Neither model dropped or hallucinated any of the 12 distractor facts we planted.

What Cloudflare's changelog actually said

The two model launches came within 4 days of each other:

  • June 12, 2026: @cf/moonshot/kimi-k2-7-code added to Workers AI. Changelog
  • June 16, 2026: @cf/zhipu/glm-5-2 added to Workers AI. Changelog

Both are billed under the same Workers AI meter — no separate Zhipu or Moonshot account needed. The official model names are @cf/zhipu/glm-5-2 and @cf/moonshot/kimi-k2-7-code; if you mistype them, Workers AI returns a helpful 400 with a list of valid IDs.

Limitations and gotchas

  • No fine-tuning endpoint — both models are inference-only on Workers AI. If you need a fine-tuned GLM or Kimi, use the Zhipu/Moonshot origin API directly (and expect the procurement friction this article started with).
  • No image or audio input on either model through Workers AI. Zhipu's CogView-3 and Moonshot's vision models are not yet on the platform.
  • Rate limits start at 60 requests/minute on the free tier and scale to 1,200 RPM on the Workers Paid plan ($5/month). Both models share the same pool.
  • Streaming is SSE, not raw token chunks. The stream: true flag emits OpenAI-style data: {...}\n\n events, not \n-delimited JSON. SDKs that expect raw chunks need a one-line adapter.
  • Cold start on Workers AI: first request after a quiet period takes 800-1200 ms as the model loads into the GPU pool. Subsequent requests are 200-500 ms.

When to use GLM-5.2 vs Kimi K2.7 Code

Use case Pick Why
Chinese-language customer support chatbot GLM-5.2 Best Chinese Q&A accuracy; cheaper output
RAG over Chinese documents (128K context) GLM-5.2 128K context; strong retrieval benchmarks
Multi-language chat (EN/ES/FR/JA + ZH mix) GLM-5.2 Cleaner cross-language output than US models
Code completion in VS Code / JetBrains Kimi K2.7 Code 256K context = whole repo, code-tuned
CI bot that auto-fixes lint errors Kimi K2.7 Code Lower temperature, deterministic output
200K-token document analysis Either (GLM faster) GLM-5.2 1.8s vs Kimi 2.4s on retrieval
Production serving from US / EU / APAC all at once Either via Workers AI Cloudflare edge handles regional routing automatically

FAQ

Q: Do I need a Chinese phone number or credit card to use GLM-5.2 or Kimi K2.7 Code on Workers AI?

No. Cloudflare handles all billing in USD. You pay Workers AI the rate card above; Zhipu and Moonshot never see your payment info or your account.

Q: Are the model weights the same as the Zhipu/Moonshot origin APIs?

Yes. The model IDs @cf/zhipu/glm-5-2 and @cf/moonshot/kimi-k2-7-code are quantized (8-bit) versions of the same weights Zhipu and Moonshot host. For benchmarks and capability tests the numbers match within 1-2%; for production workloads, the quantization is invisible at 128K context and below.

Q: Is there a free tier?

Cloudflare Workers AI gives 10,000 free neurons per day on the free plan — enough for roughly 3,000 GLM-5.2 completions at 500 input tokens each. The Workers Paid plan ($5/month) lifts the cap and gets you 1,200 RPM.

Q: Can I use the OpenAI Agents SDK or Vercel AI SDK?

Yes — both support custom base_url. Point them at your account's Workers AI endpoint and pass the model ID as model: "@cf/zhipu/glm-5-2". The streaming format is OpenAI-compatible SSE, so no adapter is needed.

Q: What about data privacy? Does Cloudflare log my prompts?

Cloudflare's standard Workers AI terms: prompts and completions are processed but not stored, and not used to train the model. For enterprise compliance, the Workers Paid plan includes a DPA and SOC 2 Type II report.

Q: How does this compare to using a third-party aggregator like FreeModel?

For pure inference, Workers AI is cheaper and faster (no extra hop). But if you also need the same model on a different aggregator for redundancy, or you want a single billing relationship across many providers, an aggregator like FreeModel bundles GLM-5.2, Kimi K2.7, and US frontier models under one OpenAI-compatible API with built-in failover — useful when Workers AI has a regional outage.

Verdict

Cloudflare's decision to host GLM-5.2 and Kimi K2.7 Code on Workers AI is the most significant China-model deployment on a global edge we've seen in 2026. It removes the procurement, firewall, and latency tax that has kept these models from reaching their natural audience.

Pick GLM-5.2 for any Chinese-language workload, multi-language chat, or RAG. Pick Kimi K2.7 Code for any code-generation or repo-level analysis. If you need both, the Workers AI binding lets you switch model IDs without changing the rest of your Worker — you can route by use case in the same code path.

If you're already running Cloudflare Workers, the upgrade is a 5-line change. If you're not, Workers AI's free tier is generous enough to evaluate both models on a real workload before committing to the $5/month Workers Paid plan.

Pricing and performance data collected June 16-17, 2026, from Cloudflare Workers AI changelogs and live test calls. Model quantization is 8-bit. Latency measured from 3 origin points with 100-sample median. Test prompts and code samples available on request.