Field SOP
Field SOP

Zero-Cost AI Multimodal Workflow SOP: Free API + Chinese Models + Local Models

Stack three layers to build a zero-cost multimodal pipeline in 2026: Agnes's free OpenAI-compatible API (one key for text/image/video), Chinese pay-as-you-go models (DeepSeek/Qwen/Jimeng/Kling), and local open-weight models (Wan2.1/Hunyuan/CogVideo). Includes a five-step SOP, runnable Python with async video polling and local fallback, plus five pitfalls.

Published August 10, 20268 min read
<!-- zero-cost-ai-multimodal-workflow-sop | sop | Zero-Cost AI Multimodal Workflow SOP: Free API + Chinese Models + Local Models -->

Building an AI workflow that emits text, images, and video in 2026 no longer requires paying OpenAI a monthly fee. Three shifts collapsed the cost structure: OpenAI-compatible multimodal APIs with free tiers appeared (Agnes covers text, image, and video behind one key); Chinese model APIs matured into a full matrix (DeepSeek, Tongyi Qwen, Jimeng, Doubao, Kling span text to audio/video); and open-weight video models became usable locally (Wan2.1, Hunyuan, CogVideo run on consumer GPUs). Three legs--when one falters, the other two hold. That is what makes "zero cost" real, not betting that any single provider stays free forever.

This SOP gives a copyable flow: audit needs -> unify access -> build a minimal pipeline -> local fallback -> cost control, in five steps. Code is compiled from Agnes's official docs, OpenMontage's PROVIDERS.md (the Chinese/local model registry), and each provider's official docs, current as of 2026-08-10; API shapes follow the official source, and free quotas are subject to each platform's announcements. It complements this batch's Agnes 5-model review (which Agnes model to pick), OpenMontage as a domestic alternative (its PROVIDERS list feeds this SOP's model mapping), and the Hy3 free-window hotspot (another free text-model option, free before 8/31). Read them together.


1. Why Zero Cost Works in 2026: Three Layers, Each Covering a Gap

"Zero cost" is not freeloading one API. It is three layers stacked so single-provider dependency drops to zero:

  • Free API layer: An OpenAI-compatible multimodal gateway like Agnes covers text/image/video behind one key with RPM and quota. Low integration cost (swap base_url), but limited quota that may change. See this batch's Agnes review.
  • Chinese model layer: DeepSeek (text/code), Tongyi Qwen via DashScope (image+TTS+ASR), Jimeng (ByteDance, video), Doubao Speech (TTS), Kling (Kuaishou, video). Pay-as-you-go but cheap--the first fallback when free quota runs out. Hy3 has a free window before 8/31 and can temporarily serve as a text workhorse.
  • Local model layer: Wan2.1 (Alibaba, video), Hunyuan (Tencent, video), CogVideo (Zhipu, video), WhisperX (subtitles). Zero API cost, GPU-hungry--the last-resort fallback when quota is fully spent.

The layers are not "pick one." They form a degradation chain: free tier maxed -> switch to Chinese pay-as-you-go -> switch to local. No single layer is stable alone; stacked, they are.


2. Need -> Model Mapping Table

Before coding, list the modalities you need and rank each by "free first -> Chinese next -> local fallback." This table aligns with OpenMontage's PROVIDERS.md and is reusable:

ModalityFree firstChinese alternative (usage-based)Local fallback (zero cost)
Text/codeAgnes agnes-2.5-flashDeepSeek / Qwen-Max / Hy3 (in free window)Qwen local / llama.cpp
Text-to-imageAgnes agnes-image-2.1-flashQwen-Image (DashScope) / JimengSD / Flux local
Image/text-to-videoAgnes agnes-video-v2.0Jimeng / KlingWan2.1 / Hunyuan / CogVideo
TTSAgnes (if offered)Doubao Speech / Qwen TTSedge-tts / XTTS local
Subtitles--WhisperX local

How to use: pick one primary per row, two fallbacks; have your orchestrator switch based on quota state.


3. The Five-Step SOP

Step 1 Audit needs and model mix: list your modalities; assign each a primary plus two fallbacks from the table in section 2. The point is not to pick only a primary--free quota always runs out, and a pipeline with no fallback dies the first time it hits the cap.

Step 2 Unify access: OpenAI compatibility is the key. Agnes gives one key + one base_url for both text and image (use the openai SDK directly), saving you three SDKs' worth of cognitive overhead. Non-compatible Chinese APIs (e.g., DashScope) use their native SDK, but wrap them behind a uniform interface (a single generate_text(prompt) / generate_image(prompt) signature) so swapping models only changes the implementation.

Step 3 Build the minimal pipeline: get text -> image -> video working as one chain first. Do not pile on five modalities at once. Once this chain runs, adding TTS or subtitles is wiring, not a rewrite. Section 4 has runnable code.

Step 4 Local fallback: add a switch VIDEO_GEN_LOCAL_MODEL=wan2.1-14b on the video step so quota exhaustion routes to local generation. Section 5 has the config.

Step 5 Cost control: cache repeated requests, run video off-peak, rotate keys (watch the ToS), keep video tasks async and serial--do not fire them concurrently. Monitor usage per endpoint; the moment you cross the free tier, drop to the next layer of the degradation chain.


4. Minimal Runnable Pipeline: Text -> Image -> Video

This Python runs three steps: agnes-2.5-flash writes the storyboard -> agnes-image-2.1-flash renders the first frame -> agnes-video-v2.0 turns the image into video (async polling). Text and image go through the openai SDK (compatible); video is a task-based async endpoint hit directly with requests.

python
import os, time, requests
from openai import OpenAI

AGNES_KEY = os.getenv("AGNES_API_KEY", "ag-xxxxxxxx")  # desensitized; never hardcode
BASE = "https://apihub.agnes-ai.com/v1"

# Text + image via the OpenAI-compatible SDK: just swap base_url
client = OpenAI(api_key=AGNES_KEY, base_url=BASE)

# Step 1 Text: generate a 15s storyboard (free tier, 20 RPM)
script = client.chat.completions.create(
    model="agnes-2.5-flash",
    messages=[{"role": "user",
               "content": "Write a 15-second product video storyboard. Output three shot descriptions, one per line."}],
)
shots = script.choices[0].message.content
first_shot = shots.splitlines()[0]
print("Storyboard:", shots)

# Step 2 Image: text-to-image (image RPM quota)
img = client.images.generate(
    model="agnes-image-2.1-flash",
    prompt=first_shot,
    n=1,
    size="1280x720",
)
image_url = img.data[0].url
print("First frame:", image_url)

# Step 3 Video: image-to-video, async task (video quota)
# Video is a task endpoint not in the openai SDK; hit Agnes directly with requests
headers = {"Authorization": f"Bearer {AGNES_KEY}"}
create = requests.post(f"{BASE}/videos/generations", headers=headers, json={
    "model": "agnes-video-v2.0",
    "image": image_url,
    "prompt": shots,
}, timeout=30).json()
task_id = create["id"]

# Critical: video is async. You MUST poll; the create call only returns an id.
for _ in range(60):  # wait up to 10 minutes
    st = requests.get(f"{BASE}/videos/generations/{task_id}",
                      headers=headers, timeout=30).json()
    if st["status"] == "succeeded":
        print("Video URL:", st["video"]["url"])
        break
    if st["status"] == "failed":
        raise RuntimeError("Video generation failed: " + st.get("error", "unknown"))
    time.sleep(10)

Quota per step: text 20 RPM, image under the image RPM quota, video under the task quota--all subject to the platform. When quota runs out, swap Step 3 for the local fallback in the next section; the first two steps stay untouched.


5. Local Model Fallback Config

Video quota runs out first, so local fallback mainly covers video. Set VIDEO_GEN_LOCAL_MODEL; when quota is short, the script routes to a local Wan2.1 run with zero API cost:

python
# Local fallback: Wan2.1 offline video, zero API cost
# Env: pip install diffusers torch accelerate
# Sizing: 24GB+ VRAM for 14b; ~8GB for 1.3b. Pick to your hardware.
import os, torch
from diffusers import WanPipeline

model_id = os.getenv("VIDEO_GEN_LOCAL_MODEL", "Wan-AI/Wan2.1-T2V-14B-Diffusers")
pipe = WanPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16).to("cuda")

video = pipe(
    prompt=first_shot,          # reuse the storyboard line from above
    num_frames=49, height=720, width=1280,
    num_inference_steps=30,
).frames[0]
# Export to mp4 with imageio / opencv (omitted)

Sizing discipline: 24GB+ VRAM for the 14b (best quality); otherwise the 1.3b (lower quality but it runs). Hunyuan and CogVideo are drop-in alternatives with similar interfaces. Local fallback ignores RPM limits--slow but stable, the last line of defense when the free tier is gone.


6. Five Pitfalls

Pitfall 1: Treating a free API as production Quota runs out and the service stops; with no fallback you go dark on the spot. Fix: give every modality a Chinese/local fallback per section 2, and have the orchestrator auto-degrade on 429 or quota errors. Never let the pipeline single-depend on the free tier.

Pitfall 2: Not polling video, getting nothing back Video is an async task: the create endpoint returns only a task_id; status and result live on the query endpoint. Use the create response directly and you get an id, not a video. Fix: loop GET /videos/generations/{id} like section 4, with a max wait and a failure branch.

Pitfall 3: Assuming every Chinese model is drop-in Chinese model APIs are not uniform. DashScope is not OpenAI-compatible--parameter names and response shapes differ; Jimeng and Kling each have their own signatures. Fix: use the native SDK for non-compatible ones, but wrap them behind a uniform interface (generate_image(prompt)->url) so swapping models changes only the implementation, not the pipeline.

Pitfall 4: Forcing a 14b locally and OOMing The 14b needs 24GB+ VRAM; forcing it causes OOM or glacial speed. Fix: check your GPU first--8-12GB takes the 1.3b, 16GB the 5b, 24GB+ the 14b. Watch real usage with nvidia-smi and leave headroom for the OS.

Pitfall 5: Multi-key rotation tripping the ToS Spinning up multiple accounts to concurrency-farm video quota can violate the terms of service and get you banned. Fix: run video serially on one account (video is async-slow anyway; concurrency buys nothing), and reserve multi-key for isolating usage across distinct projects, not for concurrency-farming one account.


7. FAQ

Q1: Is Agnes's free quota enough? Enough for prototypes and small-batch production, not for scale. Text at 20 RPM covers personal daily use; image RPM covers tens of images; video quota is the smallest and runs out first. The rule: after the pipeline runs, check a week of real usage--past 70% of the free tier, move the video step to local or Chinese pay-as-you-go. Quotas change; trust the platform.

Q2: Can I build this without Agnes? Yes. Agnes's value is one key for all modalities plus OpenAI compatibility, which saves integration effort. You can go all-Chinese: DeepSeek text + Qwen-Image + Jimeng video, pay-as-you-go but cheap. Or all-local: Qwen local + Flux + Wan2.1, zero API cost but GPU-bound. Agnes is just the most convenient "free-first" layer, not a requirement.

Q3: How long does local video take? The 14b on a 24GB card takes minutes to low-teens for 5s of 720p (depending on step count)--slower than APIs but free. The 1.3b is much faster but lower quality. If time matters, prefer an API (free or paid); keep local as fallback only.

Q4: n8n or Python scripts for orchestration? For prototypes and a single pipeline, Python is most direct (this article's code). For visual editing, scheduled triggers, branching, and human-in-the-loop approval, use n8n. They are not exclusive: n8n can call your wrapped Python functions, keeping complex logic in Python and scheduling in n8n.

Q5: How does this relate to OpenMontage? They complement each other. OpenMontage is an open-source orchestration framework whose PROVIDERS.md catalogs Chinese/local models (this SOP's section 2 mapping aligns with it). You can run this SOP's flow by hand in Python, or slot it into OpenMontage to reuse its provider adapters and skip writing the uniform interface yourself. See this batch's OpenMontage guide.


Reusable Orchestration Template

text
# Multimodal workflow orchestration template (pseudocode)
PIPELINE:
  1. text_gen(prompt) -> script          # Agnes agnes-2.5-flash, free first
  2. image_gen(script.first_shot) -> img  # Agnes agnes-image-2.1-flash
  3. video_gen(img, script) -> video      # Agnes agnes-video-v2.0; on quota, local Wan2.1
  4. (optional) tts(script) -> audio      # Doubao Speech / Qwen TTS
  5. (optional) asr(audio) -> subtitle    # WhisperX local

FALLBACK_RULE:
  On failure or 429 -> degrade per mapping table: free -> Chinese usage-based -> local
  Video step prefers local (cost-sensitive); text/image prefer Chinese usage-based (quality-sensitive)

COST_RULE:
  Cache identical-prompt results; video async and serial, never concurrent; monitor per-endpoint usage

References

This article is AI-assisted and human-edited. Last updated: 2026-08-10

FAQ

Is Agnes's free quota enough?
Enough for prototypes and small-batch production, not for scale. Text 20 RPM covers personal daily use; images cover dozens; video quota is the smallest and most easily exhausted. After running a week, if you exceed 70% of free tier, switch video to local or Chinese pay-as-you-go; quotas change per platform.
Can I build this without Agnes?
Yes. Agnes's value is one key for all modalities + OpenAI compatibility saving integration effort. You can go all-Chinese (DeepSeek+Qwen-Image+Jimeng, pay-as-you-go but cheap) or all-local (local Qwen+Flux+Wan2.1, zero API cost but GPU-hungry). Agnes is just the easiest free-first layer, not required.
How long does local video generation take?
14b on a 24GB GPU takes minutes to ~15 min for 5s 720p -- slower than API but zero cost; 1.3b is faster but lower quality. For time-sensitive tasks use API; local is only fallback.
n8n or Python scripts for orchestration?
Python is most direct for prototypes and single pipelines; n8n for visual, scheduled, multi-branch, human-in-the-loop approval. They compose: n8n calls wrapped Python interfaces, complex logic in Python, scheduling in n8n.
How does this relate to OpenMontage?
Complementary. OpenMontage is an open-source orchestration framework; its PROVIDERS.md lists Chinese/local models (this SOP's mapping table aligns with it). You can run the pipeline in pure Python, or plug into OpenMontage to reuse its provider adapter layer and skip writing a unified interface yourself.

Related

Field SOP

Five Open Speech Models in One Drop: Ant's MIT-Licensed Ming-3.0

Ant Group's inclusionAI open-sourced the five-model Ming-3.0 speech family under MIT on 2026-10-19/20 (multi-source confirmed; self-host, fine-tune, and commercial use all allowed), covering synthesis, audio understanding and dialogue, and recognition: Ming-3.0-tts-0.5B (0.5B dense, the lightest, deployable on four cards), Ming-3.0-tts-tiny (7.9B total / 1.3B active MoE, long-form multi-speaker podcasts), Ming-3.0-audio-flash (126B total / 6.5B active MoE, audio understanding and dialogue, answering in text or speech), Ming-3.0-audio-tiny (9.3B / 2.7B, efficiency-oriented), and Ming-3.0-asr-tiny (8.6B / 2B, context-aware transcription). Capabilities: TTS with text-described voices, a director mode that controls emotion, stress, and pacing in natural language, voice cloning, seven languages plus two dialects; audio understanding takes long recordings directly with structured output, preserving emotion and speaker identity, plus tool-call generation; ASR adds dialect recognition, hotword injection, and context awareness. Setup (verified against kie.ai and the README): TTS route - git clone github.com/inclusionAI/Ming-3.0-tts, conda env (0.5B: python 3.10, pip install -r requirements.txt, conda install -c conda-forge pynini==2.1.6), run per README; tts-tiny needs its own env with Python 3.10.15, PyTorch/Torchaudio 2.7.1 (cu118), Transformers 4.46.3; audio-flash via downloaded weights or Ling Studio Chat (ling.tbox.cn), 128K context, speech output through the Chat Completions audio.voice field with modalities=["text","audio"]. Hardware: officially tested mainly on datacenter cards - recommended NVIDIA H800 (80GB) or H20 (96GB); 0.5B on four cards is the floor; consumer-GPU feasibility unverified. Day-0 ecosystem: vLLM-Omni and SGLang-Omni adapted. Internal Ant usage (official): asr-tiny in the Afu doctor assistant, Alipay Search, Yixiaobao realtime voice, and security verification. Four limitations stated as-is: no quantized files (no GGUF/AWQ/EXL2), streaming in doubt (SGLang-Omni returns a full waveform even with stream=true, so true first-audio latency is unestablished), mutually exclusive control modes (voice design, emotion, and dialect cannot combine in one call), and unpublished training data. Leaderboard backing (secondary): Artificial Analysis TTS leaderboard (Provider Voices) puts Ming-3.0-tts at 1244, near the top. Division note: voice-cloning-toolkit-comparison-review (2026-10-15) is the review-lane selection piece; this SOP lane covers hands-on setup of the five-model stack - different lanes, different angles.

Oct 21, 20269 min read
Field SOP

AI Cross-Session Memory in 10 Minutes: MemHub Hands-On Guide

A hands-on SOP for wiring Tencent Hunyuan's ready-made memory stack into your AI agent, with every command taken from the MemHub README and verified against PyPI. Three install layers: the SDK via pip install hy-memory==2.0.3 (latest at writing time); the CLI via the npm memhub-cli bootstrapper (about 384KB) followed by memhub install to fetch the Runtime; data lives in ~/.one-memory. Platform support at v1.0.3: Linux x64/arm64 Runtime, macOS arm64/x64 App - Windows is not supported (explicit in the README; bolded in the body plus an FAQ, since many of our readers run Windows). Ten CLI commands walked through one by one: serve/start/stop/restart/status/doctor/install/upgrade/uninstall/delete-data, with a first-run flow example (install, then status to verify, doctor for a health check, serve, then connect your agent). Privacy boundary stated as-is: no screen capture, no OCR, no keyboard/mouse event collection, no clipboard reading, no audio recording. Tool count in two versions: the MemHub README lists 5 tools while Tencent's official WeChat article says 10 - the body picks neither and defers to actual CLI output. A standalone preview warning: both Hy Memory 2.0 and MemHub are preview-stage; commands and APIs may change, use with care in production. Pitfalls covered: a fallback route for Windows readers (WSL2 or wait for official support), pinning ==2.0.3 for reproducibility, and backing up ~/.one-memory by copying the directory. Division note: ai-agent-long-term-memory-sop (2026-08-08) covers the build-your-own mem0/Letta route (vector store plus files); this piece is Tencent's ready-made stack for readers who want it running today. Primary search phrase "AI cross-session memory" (S1=2/S2=1/S3=2/S4=3, about 8 points) lives in the title and this summary only, never in the article body.

Oct 20, 20269 min read
Field SOP

Claude Code DeepSeek Setup: Nine Env Vars, No Old Tutorials

A hands-on SOP for wiring Claude Code straight into DeepSeek, with every command and variable taken from the official guide (api-docs.deepseek.com/quick_start/agent_integrations/claude_code), reflecting the current configuration after the 1017 checkpoint. Primary search phrase: "Claude Code DeepSeek setup" (S1=3/S2=1/S3=2/S4=3). Migration path with nine environment variables: ANTHROPIC_BASE_URL to https://api.deepseek.com/anthropic, ANTHROPIC_AUTH_TOKEN with your DeepSeek API key, ANTHROPIC_MODEL=deepseek-flash[1m], DEFAULT_OPUS and DEFAULT_SONNET also deepseek-flash[1m], DEFAULT_HAIKU=deepseek-flash, CLAUDE_CODE_SUBAGENT_MODEL=deepseek-flash, CLAUDE_CODE_EFFORT_LEVEL=max, CLAUDE_CODE_AUTO_COMPACT_WINDOW=786432; both PowerShell and Linux/Mac variants are given. Install from scratch in four steps: Node.js 18+ (plus Git for Windows on Windows), npm install -g @anthropic-ai/claude-code, verify with claude --version, set the variables and run claude in your project directory. Model mapping: requests starting with claude-opus route to deepseek-v4-pro (billed at V4 Pro prices, pricier than Flash - a must-read reminder), claude-haiku and claude-sonnet route to deepseek-flash. Web Search works natively but bills on two lines: search requests per the Search API plus extra token costs for summarizing retrieved content. Pricing (official rate page): off-peak 0.15 dollars per million input tokens on cache miss, 0.003 on a hit (one fiftieth of the miss price), 0.60 output; peak (weekdays 01:00-04:00 and 06:00-10:00 UTC) doubles everything; weekends and Chinese public holidays count as off-peak. Five pitfalls: AUTH_TOKEN and API_KEY are not the same thing (mixing them equals no config), old and new variables coexisting can cause auth conflicts (keep only the new ones, per community guides), never commit keys via settings.json (persist them in ~/.bashrc, ~/.zshrc or system environment variables), validate the tool-calling chain with a minimal read-one-file-then-edit-one-file task before real work, and check the live model with /status. Older tutorials still reference retired names like deepseek-chat. Division of labor: deepseek-v4-pro-claude-code-sop is the V4-Pro-0813-era two-variable minimal setup (2026-09), while this piece is the full current official configuration after 1017; for the Harness itself see deepseek-harness-quickstart-sop.

Oct 19, 202610 min read