GLM and Qwen / Aug 23, 2026

GLM and Qwen API Routing: Batch, Cache, and Tool-Cost Controls

Route GLM and Qwen API workloads with dated pricing checks, batch discounts, cache rules, tool fees, and OpenAI-compatible budget ledgers.

Keyword report: 2026-08-22Tier 1/2 developer focusPrices checked Aug 23, 2026

This guide uses source checks from Aug 23, 2026. Provider and gateway prices can change; preserve the checked date with every forecast.

Why This Topic Fits the Current Keyword Report

The 2026-08-22 keyword report lists `glm api`, `qwen api`, `chinese llm api`, `api aggregation platform`, and `openrouter chinese models` in the monitored market scope. It also recommends stronger internal links from docs, pricing, and migration pages to DeepSeek, GLM, Qwen, and Kimi comparison content. This article targets that gap with a practical routing guide rather than another broad Chinese AI model overview.

GLM and Qwen should not be evaluated only by one rate row. Z.AI's GLM pricing page checked on Aug 23, 2026 lists GLM-5.3, GLM-5.2, and GLM-5.1 at $1.40 input, $0.26 cached input, and $4.40 output per 1M tokens. QwenCloud's pricing page checked the same day explains tiered text billing, Batch API behavior, context caching, thinking-token billing, and tool fees. Those details change route design.

What the Live Sources Say

Z.AI publishes text model prices per 1M tokens and separates input, cached input, cached input storage, and output. The visible GLM-5.3, GLM-5.2, and GLM-5.1 rows share the same $1.40 input, $0.26 cached input, and $4.40 output structure, while GLM-5 and GLM-5-Turbo have different rows. The same page lists Web Search as $0.01 per use, which means tool calls should be tracked outside token totals.

QwenCloud's pricing page says text generation is billed per million tokens, with input and output priced separately. It also states that some models use tiered pricing based on the total input tokens in a single request, that Batch API input and output rates are 50 percent of real-time pricing, that context caching discounts vary by model, and that thinking tokens count as output tokens. Batch and cache discounts are not combined on the same request.

Routing Matrix for GLM and Qwen

The right route depends on workload shape. GLM may be a strong candidate for reasoning, structured review, and tool use. Qwen may be attractive for coding, batch processing, and context-aware workloads. The production route should be chosen from acceptance tests and ledger behavior rather than from a generic model family preference.

WorkloadCandidate familyCost driverControl
Reasoned policy reviewGLMOutput and tool callsReviewer flag, output cap, tool ledger
Coding patch generationQwenOutput and thinking tokensPatch-only output and route tests
Large async extractionQwen Batch APIInput volumeBatch route and no cache stacking assumption
Structured classificationGLM or QwenSchema repair retriesOne repair attempt and validator
Research with web lookupGLM with toolsPer-use tool fee plus tokensTool budget and source log

A Route Policy With Separate Cost Fields

A useful policy names the route, the workload, the maximum output, whether batch is allowed, whether tool use is allowed, and which source date was used. That keeps a later finance review from guessing why two jobs with the same input tokens cost different amounts.

from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY_HERE", base_url="https://aiwave.live/v1")

ROUTE_POLICY = {
    "policy_review": {
        "model": "glm-5.3",
        "max_tokens": 1500,
        "tools_allowed": True,
        "batch_allowed": False,
        "source_checked_at": "2026-08-23",
    },
    "nightly_extraction": {
        "model": "qwen-batch-route",
        "max_tokens": 600,
        "tools_allowed": False,
        "batch_allowed": True,
        "source_checked_at": "2026-08-23",
    },
}

def run(kind: str, prompt: str):
    route = ROUTE_POLICY[kind]
    return client.chat.completions.create(
        model=route["model"],
        messages=[{"role": "user", "content": prompt}],
        max_tokens=route["max_tokens"],
    )

Batch Is Not Just a Price Toggle

QwenCloud's pricing page makes Batch API attractive for async workloads because token rates are listed at 50 percent of real-time pricing. But batch is a product behavior, not only a rate modifier. It changes latency expectations, queue monitoring, retry handling, and customer communication. Use it for nightly extraction, offline enrichment, report generation, and other jobs that do not need an immediate answer.

Do not mix discount assumptions casually. The same QwenCloud page states that batch and cache discounts cannot be combined on the same request. A forecasting table should therefore model real-time with cache separately from batch without cache stacking. That distinction prevents optimistic estimates that will not reconcile with invoices.

Cache Rules and Context Tiers

Caching is useful only when the application can produce stable prefixes and read provider usage fields. For GLM, the pricing table separates cached input from input. For Qwen, the pricing page says cached input receives a model-specific discount and that some text models use tiered pricing based on the full input size of a single request. These are different controls and should not be collapsed into a single `prompt_tokens` column.

For large prompts, store input length bands and cache share. If a Qwen request crosses a context tier, all tokens in the request may be billed at the matched tier rather than having the first segment priced at a lower tier. That detail matters for long documents, codebase context, and multi-turn prompts where historical turns continue to grow.

Tool-Cost Governance

Tool calls can become a separate line item. Z.AI's pricing page lists Web Search at $0.01 per use. QwenCloud lists Web Search at $10 per 1K calls, Image Search at $8 per 1K calls, and says function calling and MCP have no separate tool fee while tool descriptions count as input tokens. The exact route and provider decide which line applies.

The safe design is a tool ledger. Store tool name, provider route, call count, success status, and the prompt or task that requested it. Add per-task tool limits. A research workflow may justify several searches; a classification workflow usually should not. Without these fields, tool spend hides behind model spend and is hard to optimize.

Deployment Checklist

Before publishing a GLM or Qwen routing policy, review source dates, route names, cache fields, batch eligibility, tool fees, output caps, and retry classes. Confirm that every public price in documentation points to the page that was checked, and that AIWave gateway behavior is not confused with direct provider billing.

After launch, inspect the top workloads by total cost and by variance. Look for long prompts crossing context tiers, batch jobs that should move out of real-time routes, tool calls that repeat unnecessarily, and schema repairs that add output tokens. Those reviews turn GLM and Qwen routing from model selection into a maintainable production system.

Source Links

Related AIWave Links