How to Unlock Unlimited Tokens and 4K Image Generation in Claude Code with Agnes AI
This article details Agnes AI’s free multimodal models—including a text model with 1 M‑token context and an image model supporting 4 K resolution—shows weekly usage of 3.12 T Token, explains why high traffic can cause latency, and provides a step‑by‑step guide to integrate these models into Claude Code via CC Switch, complete with examples, GitHub resources, and testing tips.
Model Overview
Agnes AI provides three free multimodal models: Agnes-2.0-Flash – text generation with a 1 M‑token context window. Agnes-Image-2.1-Flash – image generation supporting 1K, 2K, 3K and 4K resolutions (up to 4096×4096) and common aspect ratios (1:1, 16:9, 4:3, 21:9, etc.). Agnes-Video-2.0 – video generation with 720p/1080p output and multi‑frame, multi‑shot capabilities.
Weekly Usage
The free API processed 3.12 T Token in the latest week. The text model contributed about 1.9 T Token, while the image and video models together contributed about 1.2 T Token. High‑volume multi‑round interactions cause occasional latency spikes and request queuing.
Claude Code Integration
Integration flow: Claude Code → CC Switch → Agnes API.
Obtain an API key : Register at https://platform.agnes-ai.com/, create a new key and copy it.
Install CC Switch : Download the release from https://github.com/farion1231/cc-switch/releases and launch the application. Select the claude-cli tab (or Claude(ClaudeCode)-desktop for Claude Desktop).
Add Agnes as a custom supplier in CC Switch:
API Key – paste the key from step 1.
Endpoint – https://apihub.agnes-ai.com/v1 Format – openai chat completions Model – agnes-2.0-flash Click “Get model list” to verify the model appears.
Configure compatibility parameters to accept fields that Claude Code may send (e.g., thinking, context_management):
{
"allowed_openai_params": ["thinking", "context_management"],
"litellm_settings": {"drop_params": true}
}Enable routing : In CC Switch’s routing page, enable the Claude‑related route. If the route is disabled, requests never reach Agnes even with correct configuration.
Validate the setup with a lightweight query, for example:
请用 5 句话解释 Java 中 HashMap 扩容为什么可能影响性能。A successful response confirms the integration; otherwise check CC Switch logs, API key, endpoint, and model name.
4K Image Generation
To generate a 4K image, change the size field from 1K to 4K in the request JSON:
{
"model": "agnes-image-2.1-flash",
"prompt": "一张 AI Agent 产品落地页首屏图,干净明亮,不要文字,不要水印",
"size": "4K",
"ratio": "16:9"
}Response URLs can be returned as url or b64_json depending on the workflow.
Five concrete scenarios where 4K resolution reveals quality differences:
Product landing‑page hero image – includes laptop screen, code editor and UI elements; high resolution shows edge sharpness.
E‑commerce product main image – tests material texture, reflections and background consistency.
City nightscape – evaluates distant building details, wet ground reflections and neon lighting.
Portrait half‑body – checks facial features, hair edges and clothing texture.
App icon – verifies crisp edges and clean layers at 1:1 size.
1 M‑Token Context Window
The text model’s 1 M‑token context allows feeding long documents (technical manuals, contracts, codebases) without fragmenting them. The request payload must keep the total messages content within the 1 M‑token limit.
Typical use cases:
Cross‑section Q&A over lengthy technical manuals or meeting minutes.
Analyzing medium‑scale codebases to understand module relationships, call chains and configuration flows.
Comparing multiple related documents to surface contradictions or duplicated conclusions.
Example prompt for code‑base analysis:
请帮我看看这个项目的多模型切换模块是如何实现的。
要求:
1. 列出关键文件;
2. 说明从入口到模型调用的完整链路;
3. 找出最容易出问题的 3 个点;
4. 只输出分析结果,不修改代码。Community Tools and Skills
Several GitHub repositories wrap the Agnes APIs as ready‑to‑use skills:
https://github.com/Yacey/agnes-ai-generation-skill – unified Agent Skill for text, image and video, with Chinese‑to‑English prompt translation.
https://github.com/kangarooking/agnes-free-model-skills – three local skills ( agnes-free-text, agnes-free-image, agnes-free-video) supporting streaming output, async video jobs and automatic retry on HTTP 502/503/504/524 errors.
https://github.com/16nic/comfyui-agnes-ai – ComfyUI node set exposing 1K/2K/4K image generation and common video pipelines, with built‑in retry logic for server errors.
Efficient Testing Tips
Run a lightweight code‑analysis task via Claude Code (e.g., a Markdown link checker) to verify basic connectivity.
Generate a 4K image for a well‑defined scene (product hero, e‑commerce, portrait, cityscape, app icon) and inspect edge details.
Submit a 1 M‑token context request containing README, key source files and configuration, then verify the model correctly describes module relationships.
Defer video and TTS testing until the APIs stabilize; start with image‑to‑video drafts and simple narration scripts.
When embedding these steps into production pipelines, add timeout handling, exponential back‑off retries, and human review for generated media.
Target Users
Developers who use Claude Code, Codex or Opencode for code explanation, test generation and low‑risk refactoring.
Content creators who need rapid iterations of 4K visuals, product mock‑ups or short video drafts.
AI‑prototype builders who want a single API for text, image and video to prototype end‑to‑end applications without juggling multiple vendors.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
