qvib.pro
RU

Vibe coding free: Cline + GLM-5.1

What for: the Cline agent in VS Code writes code for you. Free via OpenRouter or Ollama; near-free with GLM-5.1 — Opus-level for a fraction of the cost.

бесплатно open-source локально новичок

GLM-5.1: контекст 200K, SWE-Bench Pro 58,4 (у Claude Opus 4.6 — 57,3), API $1.4/$4.4 за 1M токенов — официальная документация Z.ai checked 2026-07-14

Updated: 14.07.2026

$ npx -y @upstash/context7-mcp # should start with no errors (Ctrl+C to …
Vibe coding free: Cline + GLM-5.1

Claude Opus writes the best code out there — but $5/$25 per million tokens burns through a budget in one evening. The open GLM-5.1 is neck and neck with Opus on coding benchmarks and costs 3.5–5.7x less. Let's hook it up to the Cline agent in VS Code — and go through the fully free options too 👇

"Vibe coding" = you describe the task in plain language, the AI agent writes/edits files and runs commands itself, and you check the result. This setup is free or nearly so: the editor and the agent are free, and the "brain" is either OpenRouter's free tier, or a local Ollama (0 ₽), or the cheap Opus-class GLM-5.1.

🧭 The whole picture

What you end up with: VS Code with an AI agent living inside it. You write "make a login page with email validation" — the agent creates/edits the files itself, runs terminal commands, and can open a browser to check the result. You act as the reviewer: you read the proposed changes and hit "accept" or "reject".

The setup has three parts:

  1. Editor + agent — VS Code and an agent extension (the hands and eyes inside the project). The main candidate is Cline: open source (Apache-2.0), 61k+ stars on GitHub.
  2. The "brain" (the model) — three tiers: free (OpenRouter :free), local and private (Ollama), Opus-class for pennies (GLM-5.1 by Z.ai).
  3. MCP tools — they give the agent access to files, up-to-date docs and the browser (see the "Connect MCP" guide).

💡 This setup used to be the "free little brother" of the paid Cursor/Claude Code. GLM-5.1 changed the math: for pennies you get a model that Z.ai itself positions at the level of Claude Opus 4.6 — more than enough for learning, prototypes and most production features.


Step 1. Install the editor and the agent

What we do: install VS Code and an agent extension.

  1. Install VS Code (free): https://code.visualstudio.com — download it for your OS and launch it.
  2. In VS Code open the Extensions tab (Ctrl/Cmd+Shift+X), find and install an AI agent. Good free/open ones:
    • Cline — an autonomous agent: edits files, runs the terminal, installs MCP, asks for confirmation before acting. Open source (Apache-2.0), 61k+ GitHub stars, 5M+ installs — one of the most popular open agents for VS Code.
    • Roo Code — a Cline fork with modes (Architect / Code / Ask) for different jobs.
    • Continue — flexible, easily hooks up to Ollama and OpenRouter.

How to tell it's OK: an agent icon (the Cline robot) has appeared in the VS Code left panel. Click it — the agent's chat panel opens.

Common mistakes:

  • Installing the wrong extension (there are many with similar names) — check the publisher and the install count.
  • Opening VS Code "just like that", with no project folder → the agent has nowhere to work. First do File → Open Folder and pick your project folder.

Step 2 (option A). Give the agent a "brain" via OpenRouter (free)

What we do: connect a cloud model with a free tier.

  1. Get a key at https://openrouter.ai → the Keys section → create a key (an sk-or-... string).
  2. In the agent's settings pick the OpenRouter provider and paste the key.
  3. Pick a model with the :free suffix — the lineup of free models changes constantly, check the "Free" filter on openrouter.ai. Free models have daily request limits — that's normal for a start.

💡 GLM-5.1 is on OpenRouter too (z-ai/glm-5.1) — paid there, but you can try it with the same key without creating a Z.ai account.

How to tell it's OK: write "hi, which model are you?" to the agent — an answer comes back. That means the key and model were picked up.

Common mistakes:

  • 401 / invalid api key — the key was copied with a space or incompletely, or pasted into the wrong field. Recreate it and paste again.
  • 429 / rate limit — you hit the free model's daily limit. Wait or switch to another :free model.
  • A model without the :free suffix is paid and will draw down your balance. Check the name.

Step 2 (option B). Fully local and private — Ollama

What we do: connect a local model — no payments and no code leaving your machine.

  1. Install Ollama (see the "Run a local model" guide) and pull a model: ollama pull qwen3.
  2. In the agent pick the Ollama provider (or "OpenAI-compatible" with base URL http://localhost:11434/v1 and any non-empty string as the key).
  3. Enter the model name exactly as it appears in ollama ls (e.g. qwen3).

How to tell it's OK: the agent answers "hi" with no internet. Your coding assistant works offline and privately.

Common mistakes:

  • connection refused on 11434 — Ollama isn't running (see its guide: ollama serve / open the app).
  • The model name doesn't match ollama ls — the agent requests a nonexistent model and gets a 404.
  • Weak hardware → the agent thinks for a very long time. Take a lighter model (qwen3:1b/llama3.2) or use option A/C (cloud).

Step 2 (option C). GLM-5.1 — a cheap Claude Opus replacement

What it is: an open model by Z.ai (MIT license, a 754B-parameter MoE), a 200K token context and up to 128K output. By Z.ai's own benchmarks it's "broadly on par with Claude Opus 4.6": SWE-Bench Pro 58.4 vs 57.3 for Opus 4.6 (to be fair: on Terminal-Bench 2.0 Opus is ahead — 65.4 vs 63.5). It claims autonomous work on a single task for up to 8 hours.

What it costs: on the API — $1.4 in / $4.4 out per 1M tokens (cached input — $0.26). The current Claude Opus 4.8 is $5/$25. So GLM-5.1 is ~3.5x cheaper on input and ~5.7x cheaper on output. There's also a GLM Coding Plan subscription from $18/mo: prompt limits per 5-hour window (Lite ~80, Pro ~400, Max ~1600), with top models eating quota at a ×3 multiplier at peak / ×2 off-peak; the plan works with Cline, Claude Code and other agents. The plans currently feature the GLM-5.2 flagship (same API price as 5.1) — check the current model list on docs.z.ai.

Connecting it to Cline (per Z.ai's official instructions):

  1. Get a key: https://z.ai → API Keys (or sign up for a Coding Plan).
  2. In Cline's settings: API Provider → OpenAI Compatible.
  3. Base URL: https://api.z.ai/api/coding/paas/v4 — the Coding Plan endpoint; if you're on the regular pay-as-you-go API — https://api.z.ai/api/paas/v4.
  4. Model: choose "Use custom" and enter glm-5.1 (or the newer glm-5.2).
  5. Context Window: 200000; uncheck Supports Images — there's no vision in this setup.

How to tell it's OK: ask the agent "which model are you?" and give it a small task — files get edited, commands get run, and an evening of work costs cents, not dollars.

Common mistakes:

  • 401 — the key is from the wrong platform: z.ai (international) and bigmodel.cn (China) have different keys and base URLs.
  • 404 model not found — a typo in the model name, or it isn't part of your plan; check the list in the Z.ai docs.
  • Throwing screenshots at the agent — the model can't see them: feed it the error text or the code, and add MCP tools for vision.

Where it's enough and where it isn't: routine work, CRUD, tests, refactoring, standard features — GLM-5.1 handles them confidently and for almost nothing. Tricky architecture, rare bugs, long turnkey autonomous sessions — Claude Opus is still steadier; GLM's generation speed depends on the provider (the median across Artificial Analysis's independent measurements is around 77 tok/s, higher with fast providers). A working scheme: GLM-5.1 as the default model, Opus surgically on the hard parts.


Step 3. Connect MCP (the agent's hands: files, docs, browser)

What we do: give the agent tools over MCP. The base kit for vibe coding:

  • Filesystem — read/write project files.
  • Context7 — pull up-to-date library documentation (fewer API "hallucinations").
  • Playwright — open a browser and check that the web flow actually works.

Cline/Roo have an MCP Servers button → "add server"; the format is the same command/args/env as in the "Connect MCP to Claude/Cursor" guide. You can check that a server even starts by hand:

npx -y @upstash/context7-mcp        # should start with no errors (Ctrl+C to exit)

How to tell it's OK: in the agent's MCP panel the server shows green/"connected", and new tools have appeared for the agent (for example "read file", "open browser").

Common mistakes:

  • No Node.js → npx isn't found. Install Node LTS from nodejs.org and restart VS Code.
  • A "red" server — a typo in command/args or no internet for npx. Check the config against the MCP guide.

Step 4. The working loop

What we do: run the "task → plan → edits → check" loop.

  1. Describe the task in words: "Make a login page with email validation and a Sign in button".
  2. The agent will propose a plan and specific file edits — read the diff before you hit "Approve" (that's your responsibility).
  3. Let it run the project and check it (through the Playwright MCP — right in the browser).
  4. If it didn't work, paste the error text and ask it to fix it. Repeat until green.

How to tell it's OK: the files changed the way you expected; the app starts; the flow you needed works in the browser.

Common mistakes:

  • Hitting "Approve" without looking → the agent quietly rewrote the wrong thing. Always look at which files and lines it's changing.
  • Turning on "auto-approve" at the start → the agent runs commands without asking. Keep confirmations on early on.
  • Asking for too big a task in one message → the agent gets confused. Break it up: markup first, then logic, then styles.

🧠 For the senior

  • Model routing: GLM-5.1 for routine work and bulk edits, Opus (or another strong model) surgically for architecture and contentious spots; in Cline the model switches in a couple of clicks right from the chat, and OpenRouter makes it convenient to compare models on one API.
  • Caching is decisive: GLM-5.1's cached input costs $0.26/1M — Cline's agent loops, with their long system prompt and repeating context, get several times cheaper on cache. Claude serves the same goal with prompt caching — but the base rates are higher.
  • Context engineering: give the agent README/ARCHITECTURE.md/repo rules as context; rules in .clinerules (Cline) / mode system instructions (Roo) save tokens and keep the style consistent.
  • MCP arsenal: add Git MCP, a DB MCP (read-only!), Sentry MCP — the agent reads logs/schema/errors on its own. Don't exceed a reasonable number of active tools, or the choice gets diluted.
  • Quality gates: ask it to run tsc --noEmit, the linter and tests after every block; don't accept code without a green run. For web flows — a mandatory browser run (Playwright), not "on faith".
  • Local for private work: code under NDA goes through Ollama only; heavy local reasoning needs a strong GPU, otherwise it's slow.

⚠️ Warnings

  • The agent runs commands on your machine. Turn on confirmation before actions (switch auto-approve off at the start). Commands like rm -rf, file overwrites, git push --force are irreversible; read what the agent is about to run.
  • Prompt injection. Don't let the agent blindly execute instructions from downloaded files and web pages — a "delete…/send the keys…" command can be hidden in there. Be especially careful with MCPs that pull external content.
  • Secrets. Don't paste keys/passwords into the agent's chat or into code in plain text — only via .env (which is in .gitignore).
  • Your code goes to Z.ai's cloud. GLM-5.1 over the API means Z.ai's servers; for code under NDA use only a local Ollama. The GLM-5.1 weights are open (MIT), but 754B parameters locally is a server farm, not a laptop.
  • "Opus level" is by Z.ai's own benchmarks. On some tasks Opus is objectively ahead (Terminal-Bench, for one); test it on your own code. Prices and plan limits change — check docs.z.ai before you pay.
  • Free models are weaker than the top ones: on complex architecture they make mistakes and hallucinate confidently. Check the output, don't take the code on faith.

🆘 Rescue prompt

Help me set up cheap vibe coding in VS Code, explain it step by step.
MY AGENT: <Cline / Roo Code / Continue>.
MY MODEL: <OpenRouter :free / local Ollama / GLM-5.1 via Z.ai>.
MY OS: <macOS / Windows / Linux>. PROJECT GOAL: <what I'm building>.
I'M STUCK ON: <what isn't working / the error text>.

What to do:
1) What to install, where to paste the key and the base URL (for GLM-5.1: OpenAI Compatible provider,
   base URL https://api.z.ai/api/coding/paas/v4, model glm-5.1, context 200000).
2) How to connect MCP (Filesystem, Context7, Playwright) — exact commands/config.
3) After each step — how to check that it works.
4) Warn me about auto-approve and security (secrets, prompt injection).

💎 Depth and value

  • The barrier to entry in code has collapsed. "Writing an app" used to mean months of learning syntax. Now you describe the task in words and check the result — and the barrier to the very idea of "building my own tool" is close to zero.
  • The top models' monopoly is over. The open GLM-5.1 (MIT) officially aims at Claude Opus 4.6 — and costs several times less. "Opus level" is available for the price of a cup of coffee a day for the first time: a strong model has stopped being a luxury.
  • Free = you can practice without fearing the bill. Free models and a local Ollama give you unlimited practice: made a mistake — redo it, and it cost nothing.
  • You learn to be a reviewer, not a typist. The key skill of the AI era isn't "typing code" — it's framing the task, reading the diff and checking the result. This setup trains exactly that — and leads smoothly to the paid Cursor/Claude Code and to Laskoff OS (a team of AI agents).

Читать по-русски →