CogView 4
Zhipu AI CogView 4 β text-to-image generation with strong bilingual prompt understanding.
CogView-4 is Zhipu AI's first open-source text-to-image model capable of generating Chinese characters natively within images. Built on a 6-billion-parameter Diffusion Transformer (DiT) architecture and using GLM-4-9B as its bilingual text encoder instead of the T5-XXL encoder used by predecessor CogView-3-Plus, it was open-sourced on March 4, 2025. At launch it ranked first on the DPG-Bench (Dense Prompt Graph Benchmark) among open-source text-to-image models, outperforming Flux.1-dev, Janus-Pro-7B, DALLΒ·E 3, and SD3-Medium on overall semantic alignment. Via the Zhipu AI MaaS API and through TheRouter.ai, it is accessed under the model identifiers cogview-4 (stable alias) and cogview-4-250304 (versioned snapshot).
For TheRouter operators, CogView-4 is accessible at Β₯0.06 per generated image ($0.0104 USD at standard exchange rates) through the OpenAI-compatible /v1/images/generations endpoint at api.therouter.ai. It accepts arbitrarily long Chinese and English prompts (up to 1024 tokens), generates images at any resolution within the 512pxβ2048px range with 16px alignment (max 2Β²ΒΉ total pixels), and supports standard and hd quality modes. The recommended workflow is to refine prompts with a large language model such as GLM-4-Plus before generation, as the model was trained on lengthy synthetic image descriptions. Generated image URLs are valid for 30 days and should be transferred to persistent storage by the caller.
- β’ Chinese-language creative workflows: CogView-4 is the first open-source T2I model that can render Chinese characters within the image itself, making it the natural choice for advertising, e-commerce banners, food and beverage promotions, and short-video thumbnails where Chinese text must be embedded in the visual
- β’ Bilingual prompt-driven production: GLM-4-9B encoder handles Chinese and English natively with equal quality; teams can write prompts in either language without translation overhead
- β’ High-resolution commercial assets: supports output up to 1920Γ1280 and arbitrary aspect ratios within the 2Β²ΒΉ pixel budget; suitable for game art, educational illustrations, and tourism promotion materials
- β’ Self-hosted / fine-tuned deployments: the 6B-parameter model is open-sourced under CogKit (THUDM/CogKit) and supports BF16 / FP32 precision, BNB int4 quantization, and LoRA fine-tuning via the CogKit toolkit
- β’ Budget-sensitive high-volume generation: at Β₯0.06/image, costs scale linearly; for free-tier prototyping use CogView-3-Flash (Β₯0), and for very high volumes evaluate whether self-hosting the open-source 6B weights is more cost-effective
- β’ Image editing, inpainting, or image-to-image: the API endpoint is text-to-image only; neither image conditioning nor editing modes are available via the MaaS API
- β’ Tasks requiring the absolute highest commercial quality: GLM-Image (hd mode, up to 2048Γ2048, Β₯0.12/image) is Zhipu's premium-tier image model; for Western photorealistic styles, DALLΒ·E 3 or Flux.1 may yield different aesthetic results
Modalities
Capabilities
Media Generation Capabilities
- sizes
- 1024x1024
- 768x1344
- 864x1152
- 1344x768
- 1152x864
- 1440x720
- 720x1440
- defaults
- size
- 1024x1024
Pricing Breakdown
| Type | Rate |
|---|---|
| Request | $0.009 / request |
| Image | $0.0108 / image |
| Per image | $0.0108 / image |
Per-image flat fee
Supported Parameters
Specifications
| Pricing | Β₯0.06 per generated image (~$0.0104 USD)docs.bigmodel.cn β | verified |
| Architecture | 6B-parameter Diffusion Transformer (DiT) with GLM-4-9B bilingual text encodergithub.com/zai-org/CogView4 β | verified |
| Open-source release date | March 4, 2025 (diffusers-compatible version)github.com/zai-org/CogView4 β | verified |
| Prompt languages | Chinese and English (bilingual, native Chinese character generation in output images)github.com/zai-org/CogView4 β | verified |
| Prompt length limit | 1024 tokens (arbitrary length; use a large language model to refine long descriptions for best results)github.com/zai-org/CogView4 β | verified |
| Supported output resolutions | Preset: 1024Γ1024 (default), 768Γ1344, 864Γ1152, 1344Γ768, 1152Γ864, 1440Γ720, 720Γ1440. Custom: 512β2048 px per side, divisible by 16, total pixels β€ 2Β²ΒΉdocs.bigmodel.cn β | verified |
| Quality modes | standard (fast, ~5β10 s) and hd (higher detail and consistency, ~20 s); default is standarddocs.bigmodel.cn β | verified |
| Supported API parameters | prompt, size, quality, n, user, watermark_enableddocs.bigmodel.cn β | verified |
| Model identifiers | cogview-4 (stable alias) and cogview-4-250304 (versioned snapshot, March 4 2025 release)docs.bigmodel.cn β | verified |
| Output URL validity | 30 days from generation; callers must transfer images to persistent storagedocs.bigmodel.cn β | verified |
| Watermark | AI watermark enabled by default (explicit + implicit digital watermark); can be disabled for accounts that have signed Zhipu AI's watermark disclaimerdocs.bigmodel.cn β | verified |
| Self-hosting inference precision | BF16 and FP32 supported; BNB int4 and TorchAO int8/int4 quantization available for reduced VRAMgithub.com/zai-org/CogView4 β | verified |
Benchmarks
| Benchmark | Distribution | Score | Source |
|---|---|---|---|
DPG-Bench (Dense Prompt Graph Benchmark) β Overall Ranked #1 among open-source T2I models at launch. Baseline comparisons: Flux.1-dev 83.79, Janus-Pro-7B 84.19, DALLΒ·E 3 83.50, SD3-Medium 84.08. | 85.13 | github.com/zai-org/CogView4 β | |
GenAI-Bench β Overall Competitive with Flux.1-dev (0.66) and DALLΒ·E 3 (0.67). SD3-Medium leads at 0.74. Strong in counting (0.66) and colors (0.79). | 0.73 | github.com/zai-org/CogView4 β |
API Usage Examples
Use the global api.therouter.ai endpoint shown below for new integrations; the legacy China accelerated endpoint is retired.
Recommended: use the async API
Image generation typically takes 30β180s, beyond the edge sync timeout. The examples below use the ?async=true submit + poll pattern. Read the full async image generation & edit guide β
# 1) Submit job (returns 202 immediately with a polling URL).
# Image generation takes 30-180s β always use the async path in production.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/generations?async=true" -H "Content-Type: application/json" -H "Authorization: Bearer $THE_ROUTER_API_KEY" -d '{
"model": "zhipu/cogview-4",
"prompt": "A cinematic product render with soft studio lighting"
}' | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"
# 2) Poll until terminal (succeeded / failed / cancelled / expired).
while :; do
R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB" -H "Authorization: Bearer $THE_ROUTER_API_KEY")
S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
echo "status: $S"
case "$S" in
succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
failed|cancelled|expired) echo "$R"; exit 1 ;;
esac
sleep 5
doneAPI guide
Image Generation (OpenAI-compatible)
Access CogView-4 through the standard OpenAI /v1/images/generations endpoint at api.therouter.ai. Use cogview-4 as the model identifier (or cogview-4-250304 to pin the versioned snapshot). Pass size as a preset string (e.g. 1024x1024) or a custom WxH within 512β2048 px divisible by 16. Set quality to hd for maximum fidelity (~20 s) or omit for standard mode (~5β10 s). Generated URLs expire in 30 days β store images immediately.
curl https://api.therouter.ai/v1/images/generations \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zhipu/cogview-4",
"prompt": "δΈεͺε―η±ηε°η«εͺοΌεε¨ι³ε
ζεͺηηͺε°δΈοΌθζ―ζ―θ倩η½δΊ",
"size": "1024x1024",
"quality": "hd",
"n": 1
}'More from zhipu
Similar models
Cross-provider sibling modelsFrequently asked
What is the difference between cogview-4 and cogview-4-250304?
cogview-4 is a stable alias that always routes to the current recommended CogView-4 release. cogview-4-250304 is a versioned snapshot that pins to the March 4, 2025 open-source release and will not be updated as Zhipu AI ships improvements. Use the stable alias for production workloads that want automatic quality improvements; use the versioned snapshot when you need reproducible output pinned to a specific checkpoint.
Can CogView-4 generate Chinese text within images?
Yes β this is CogView-4's most distinctive capability and the primary reason for switching from the CogView-3-Flash free tier. The GLM-4-9B encoder provides genuine bilingual understanding, and the model was specifically trained to render Chinese characters correctly in output images. This makes it well-suited for Chinese advertising copy, e-commerce banners, restaurant menus, and short-video thumbnails where text must be embedded in the visual.
When should I use hd quality mode versus standard?
Use quality: hd when output will appear in a customer-facing context β commercial imagery, print materials, or anywhere fine detail and global consistency matter. Generation takes approximately 20 seconds. Use standard (default) for iteration, internal previews, dataset augmentation, or any workflow where latency is more important than fidelity β it generates in ~5β10 seconds. glm-image (Zhipu's premium model) only supports hd and costs Β₯0.12/image; if you regularly need the highest quality, benchmark both models before committing.
How do I get the best results from CogView-4?
Zhipu AI explicitly recommends rewriting prompts with a large language model (e.g. GLM-4-Plus) before sending them to CogView-4, because the model was trained on lengthy, detailed synthetic image descriptions. A one-sentence prompt will work, but a refined multi-sentence description that specifies lighting, style, composition, and subject details will produce substantially better results. An example prompt optimization script is provided in the open-source repository at inference/prompt_optimize.py. CogView-3 and CogView-4 use different few-shot examples for optimization β use the cogview4 flag when calling the script.
Can I self-host or fine-tune CogView-4?
Yes. The 6B-parameter model weights are available on HuggingFace (THUDM/CogView4-6B), ModelScope, and WiseModel. It requires at least 32 GB of RAM and approximately 33β39 GB VRAM in BF16 at batch size 4 (1024Γ1024); with enable_model_cpu_offload, VRAM usage drops to ~20 GB; with BNB int4 quantization applied to the text encoder, ~13 GB. Fine-tuning is supported via CogKit (github.com/THUDM/CogKit), a toolkit from the THUDM lab that covers LoRA fine-tuning for both CogView4 and CogVideoX models. ComfyUI support is available through the community ComfyUI_CogView4_Wrapper plugin.
Fact ledger β every claim on this page traces here
| source | URL | retrieved | |
|---|---|---|---|
| Pricing | docs.bigmodel.cn β | 2026-06-09 | verified |
| Architecture | github.com/zai-org/CogView4 β | 2026-06-09 | verified |
| Open-source release date | github.com/zai-org/CogView4 β | 2026-06-09 | verified |
| Prompt languages | github.com/zai-org/CogView4 β | 2026-06-09 | verified |
| Prompt length limit | github.com/zai-org/CogView4 β | 2026-06-09 | verified |
| Supported output resolutions | docs.bigmodel.cn β | 2026-06-09 | verified |
| Quality modes | docs.bigmodel.cn β | 2026-06-09 | verified |
| Supported API parameters | docs.bigmodel.cn β | 2026-06-09 | verified |
| Model identifiers | docs.bigmodel.cn β | 2026-06-09 | verified |
| Output URL validity | docs.bigmodel.cn β | 2026-06-09 | verified |
| Watermark | docs.bigmodel.cn β | 2026-06-09 | verified |
| Self-hosting inference precision | github.com/zai-org/CogView4 β | 2026-06-09 | verified |
| DPG-Bench (Dense Prompt Graph Benchmark) β Overall | github.com/zai-org/CogView4 β | 2026-06-09 | to verify |
| GenAI-Bench β Overall | github.com/zai-org/CogView4 β | 2026-06-09 | to verify |