How to set up OpenCode with free models, agents and MCP

OpenCode is an open source coding agent you can run in your terminal with any AI model, including free ones. This guide walks you from install to skills, memory files, subagents and browser testing. It suits developers who already use a terminal and want an alternative to paid coding agents.

OpenCode Tutorial for Beginners: Setup, Agents, Skills & MCP, by Leon van Zyl on YouTube. 32 min 6 s.

9 chapters. Tap a step to jump to it.Chapters from the creator
Video length
32 min 6 s
Time to do it
45 minutes
Difficulty
Medium
Steps
8

What you need

Steps

  1. Install OpenCode with the official install command for your system, then run opencode in a terminal to confirm it launches.

  2. Sign in to OpenCode Zen to use the free models it offers, or add your own provider key if you already pay for one.

  3. Pick a model in the OpenCode model menu. Start with a free Zen model to test the workflow before spending on API tokens.

  4. Add skills from skills.sh by copying the install command for the skill you want and running it in your project folder.

  5. Create an AGENTS.md file in your project root and write your coding rules there, such as style, test commands and files to avoid.

  6. Set up subagents for narrow jobs like research or test writing so the main agent keeps its context window free.

  7. Add the Playwright MCP server to OpenCode so the agent can open a real browser and click through your app.

  8. Ask the agent to build a small feature, then let it run the Playwright tests and fix any failures it finds.

Tips and common mistakes

Keep AGENTS.md short and specific. Long rule files get ignored or eat context.

Use free models for practice and cheap tasks, and save paid models for work that needs stronger reasoning.

Give each subagent one clear job so it returns a short result instead of flooding the main context.

Check the install commands on skills.sh and MCP servers before running them, since they run code on your machine.

Questions

Do I need to pay for an API key to use OpenCode?

No. OpenCode Zen offers free models you can use after signing in. Paid API keys are optional and only needed if you want a specific model.

What is AGENTS.md for?

It is a memory file the agent reads at the start of a session. Put your project rules, commands and preferences there so you do not repeat them every time.

What does the Playwright MCP add?

It lets the agent control a real browser, so it can open your app, click buttons and check that pages work without you testing by hand.

This guide was drafted from the video's details and general task knowledge. It has not been checked against the full video. Check the video and relevant product instructions before following a procedure. Report a correction.

More in Computers & Phones

See all