Skip to content

network-tocoder/OpenCode-OpenRouter-NVIDIA-Free-AI-Coding-Agent-Setup-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 

Repository files navigation

πŸ€– OpenCode + OpenRouter β€” Free AI Coding Agent on Windows

License Platform Cost GPU Model

Run a 120B parameter AI coding agent from your terminal β€” for free. No GPU, no expensive subscription, no local hardware requirements.


πŸ“Ί Watch the Full Video

YouTube

I built a complete production landing page β€” 3 files, animations, pricing tiers, dark UI β€” in under 2 minutes. Zero cost. This repo is the complete setup guide.


⚑ What Is This?

This repo contains everything you need to set up OpenCode as a fully autonomous AI coding agent connected to OpenRouter's free tier β€” so you can run a 120B parameter model from any machine without a GPU.

Tool Role
πŸ’» OpenCode Agentic coding CLI β€” reads, writes, runs your code
πŸ”€ OpenRouter Model gateway β€” one API key, 100+ models
🟒 NVIDIA Nemotron 3 Super 120B free model β€” 262K context window
πŸ–₯️ VS Code Your editor β€” PowerShell terminal

πŸ–₯️ Requirements

Requirement Detail
OS Windows / Mac / Linux
Node.js v18 or higher
Terminal PowerShell (Windows) / Bash (Mac/Linux)
GPU ❌ Not required
API Key Free β€” openrouter.ai

πŸš€ Installation Guide

Step 1 β€” Install Node.js

πŸͺŸ Windows

Download and install from nodejs.org

Verify:

node --version

Should show v18 or higher.

🍎 macOS
brew install node
node --version
🐧 Linux
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version

Step 2 β€” Install OpenCode

npm install -g opencode-ai

Verify install:

opencode --version

Should show 1.14.24 or higher.


Step 3 β€” Create Project Folder

πŸͺŸ Windows (PowerShell)
mkdir opencode-demo
cd opencode-demo
🍎 macOS / 🐧 Linux
mkdir opencode-demo && cd opencode-demo

Step 4 β€” Get Your OpenRouter API Key

  1. Go to openrouter.ai
  2. Create a free account β€” no credit card required
  3. Go to API Keys β†’ Create
  4. Name it opencode-demo
  5. Copy your key β€” starts with sk-or-v1-

Step 5 β€” Set Your API Key

πŸͺŸ Windows β€” Session Only (PowerShell)
$env:OPENROUTER_API_KEY = "sk-or-v1-YOUR-KEY-HERE"
πŸͺŸ Windows β€” Permanent (Recommended)
[Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "sk-or-v1-YOUR-KEY-HERE", "User")

Then close and reopen your terminal.

🍎 macOS / 🐧 Linux β€” Session Only
export OPENROUTER_API_KEY="sk-or-v1-YOUR-KEY-HERE"
🍎 macOS / 🐧 Linux β€” Permanent
echo 'export OPENROUTER_API_KEY="sk-or-v1-YOUR-KEY-HERE"' >> ~/.zshrc
source ~/.zshrc

For bash:

echo 'export OPENROUTER_API_KEY="sk-or-v1-YOUR-KEY-HERE"' >> ~/.bashrc
source ~/.bashrc

Verify:

echo $env:OPENROUTER_API_KEY   # Windows
echo $OPENROUTER_API_KEY       # Mac/Linux

Step 6 β€” Explore Available Models

List all models:

opencode models

Filter free models only:

# Windows
opencode models | Select-String ":free"
# Mac/Linux
opencode models | grep ":free"

Step 7 β€” Configure OpenCode

OpenCode config is stored globally at:

OS Path
Windows C:\Users\<username>\.config\opencode\opencode.json
Mac/Linux ~/.config/opencode/opencode.json

Open config:

# Windows
code $env:USERPROFILE\.config\opencode\opencode.json
# Mac/Linux
code ~/.config/opencode/opencode.json

Paste this config:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "openrouter/nvidia/nemotron-3-super-120b-a12b:free",
  "provider": {
    "openrouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "OpenRouter",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "{env:OPENROUTER_API_KEY}"
      },
      "models": {
        "nvidia-nemotron-3-super": {
          "name": "nvidia/nemotron-3-super-120b-a12b:free",
          "limit": {
            "context": 262144,
            "output": 32768
          }
        }
      }
    }
  }
}

⚠️ The apiKey field reads from your environment variable β€” your actual key never sits in plain text.


Step 8 β€” Test Your Setup

opencode run "Who are you and what model are you running on?"

You should see a response confirming OpenCode is running on NVIDIA Nemotron 3 Super via OpenRouter. βœ…


πŸ–₯️ Using the TUI (Interactive Mode)

Launch the full terminal interface:

opencode

Key Commands Inside TUI

Command Action
/models Switch model mid-session
/theme Change UI theme
/skills Browse available skills
/sessions Manage multiple sessions
/undo Undo last agent action
/redo Redo undone action
/thinking Toggle model reasoning visibility
Ctrl+P Open command palette
Esc x2 Interrupt current task
Tab Toggle Plan / Build mode

🎯 Demo β€” Test Your Setup

Quick Test β€” Python Script

opencode run "Create a Python script called hello.py that prints Hello from OpenCode"

Full Use Case β€” Landing Page

Run this in your project folder:

opencode run "@
ACT AS: Senior Frontend Developer & UI/UX Designer.

TASK: Create a professional 3-file landing page for 'PitchZero Intelligence' β€” 
an AI-powered platform tracking venture capital funding and startup investment signals.

BRANDING:
- Theme: Deep Obsidian black (#0a0a0a)
- Accent: Electric Ultraviolet (#8b5cf6)
- Tone: High-tech, minimalist, data-driven

SECTIONS:
1. Hero with headline and CTA
2. Intelligence Stack: Live Funding Tracks, Agentic Logic Analysis, Sector Velocity
3. PitchZero Feed: mock blog/newsletter layout
4. Pricing: Free, Pro, Enterprise tiers

FILES TO GENERATE:
- index.html (Semantic HTML5)
- style.css (Flexbox/Grid, neon-glow class)
- app.js (scroll animations, newsletter signup)

OUTPUT: Write all 3 files completely.
@"

Open in browser:

# Windows
start .\index.html
# Mac/Linux
open index.html

πŸ”§ How It Works

You type a prompt in OpenCode
        ↓
OpenCode sends HTTPS request to OpenRouter API
        ↓
OpenRouter routes to NVIDIA Nemotron 3 Super (free tier)
        ↓
Model thinks, reasons, generates response
        ↓
OpenCode acts β€” creates files, runs commands, edits code
        ↓
Loop continues until task is complete

No GPU on your machine. No local model download. Everything runs in the cloud via OpenRouter.


πŸ“Š OpenRouter Free Tier β€” What to Know

Item Detail
Cost $0.00 per request on free models
Rate limit ~20 requests/minute
Daily cap Token budget per model
Data policy Free tier prompts may be used to improve models
Fix if you hit limits Add $5 credits β€” goes a very long way

πŸ’‘ Monitor your usage at openrouter.ai/activity


πŸ’‘ Tips

  • Hit rate limit mid-task? Wait for daily reset or add $5 credits
  • Wrong model ID error? Use the full ID: openrouter/nvidia/nemotron-3-super-120b-a12b:free
  • API key not found? Close and reopen terminal after setting permanent env variable
  • Want a different free model? Run opencode models | grep ":free" and update opencode.json
  • Sensitive data? Don't use free tier endpoints β€” prompts may be logged by providers

πŸ“ Project Structure

opencode-demo/
β”œβ”€β”€ opencode.json          # Optional per-project config
β”œβ”€β”€ README.md              # This file
└── outputs/
    β”œβ”€β”€ index.html         # Generated landing page
    β”œβ”€β”€ style.css          # Generated styles
    └── app.js             # Generated JavaScript

🀝 Contributing

Found an issue or want to add more model configs? Pull requests welcome.


πŸ“„ License

MIT License β€” free to use, modify and share.


πŸ”— Links

YouTube GitHub OpenRouter OpenCode


Zero Cost. No GPU. Any Machine.
Built with OpenCode + OpenRouter + NVIDIA Nemotron 3 Super

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors