How to Use MiniMax M2.1 in OpenCode: Ship Agentic Projects Faster with Novita AI

Agentic coding is moving beyond autocomplete: modern tools can plan tasks, edit multiple files, run commands, and iterate until the result works.

OpenCode is an open-source, model-agnostic coding agent that runs in the terminal (and also supports desktop/IDE). In this guide, you’ll connect MiniMax M2.1 to OpenCode via Novita AI’s API, then build a small demo project to showcase an end-to-end agent workflow.

What is OpenCode?

OpenCode is an open-source AI coding agent that you can run in multiple developer environments—most commonly as a terminal-based interface (CLI + TUI), but also as a desktop app or an IDE extension.

What is the difference between OpenCode and Claude Code

OpenCode and Claude Code are both terminal-based AI coding agents, but they take different paths.

  • OpenCode is an open-source, provider-agnostic agent: it highlights support for “75+ LLM providers through Models.dev (including local models)” and positions itself as a flexible tool you can wire to different model backends.
  • Claude Code, by contrast, is Anthropic’s official Claude-first CLI—a command-line tool to access Claude models in the terminal—plus an official ecosystem for extensions (plugins) and tool/data connections via MCP.

Quick comparison table

AspectOpenCodeClaude Code
PositioningOpen-source, multi-model terminal coding agentAnthropic’s official Claude-first terminal coding agent
Model / provider choice75+ LLM providers through Models.dev, incl. local modelsBuilt around Claude; extends via MCP + plugins
GitHub automation/opencode or /oc comment triggers; runs on GitHub Actions runnerExtensions focus on plugins/MCP (official ecosystem)
Pricing entry pointTool is open-source; cost depends on your chosen model backendClaude plans (Pro/Max/Team/Enterprise)

Why MiniMax M2.1?

MiniMax M2.1 fits OpenCode’s agent loop (plan → edit → run → fix). The benchmark scores show clear gains in repo-level coding and tool/terminal workflows.

Benchmark of MiniMax M2.1
From MiniMax

💡 Practical takeaways

  • Better at real repo fixing (SWE-bench).SWE-bench Verified: 74.0 vs 69.4 (+4.6), and SWE-bench Multilingual: 72.5 vs 56.5 (+16.0) — strong for multi-file patches and multilingual repos.
  • Strong on multi-issue agent work.Multi-SWE-bench: 49.4, ahead of Claude 44.3 and GPT-5.2 42.7 — useful when tasks require multiple coordinated edits.
  • Much improved for terminal/tool loops.Terminal-bench 2.0: 47.9 vs 30.0 (+17.9) — a good match for OpenCode’s command-running, build/test iteration.
  • High end-to-end app building scores.VIBE Avg: 88.6 (also Web 91.5, Android 89.7, Backend 86.7) — supports building complete, demo-ready projects rather than isolated snippets.

How to Install OpenCode

OpenCode provides a few installation options. The quickest is the one-line install script, and the most portable is installing the npm package.

macOS / Linux

Recommended:

curl -fsSL https://opencode.ai/install | bash

Or (cross-platform):

npm install -g opencode-ai
# or
bun add -g opencode-ai

Start:

opencode

Windows

Recommended:

npm install -g opencode-ai
# or
bun add -g opencode-ai

curl | bash requires a bash environment (WSL or Git Bash). In PowerShell/CMD, use npm/bun.

Start:

opencode

How to Use MiniMax M2.1 in OpenCode

Getting Your API Key on Novita AI

  • Step 1: Create or Login to Your Account: Visit https://novita.ai and sign up or log in.
  • Step 2: Navigate to Key Management: After logging in, find “API Keys”.
  • Step 3: Create a New Key: Click the “Add New Key” button.
  • Step 4: Save Your Key Immediately: Copy and store the key as soon as it is generated; it is shown only once.
the guide to creating your own api key

Add your Novita API key to OpenCode

  1. Launch OpenCode:
opencode
  1. In the OpenCode prompt, run:
/connect
  1. Search and select Novita AI, then paste your Novita API key.
  2. Select MiniMax M2.1 (model id: minimax/minimax-m2.1).

That’s it—OpenCode will route agent requests through Novita AI’s OpenAI-compatible API using the model you selected.

Switch to Build mode and execute

In OpenCode, switch to Build mode (tools enabled), then paste the prompt below.

Prompt

Build a lightweight browser maze game called “Clean Maze Runner” and run it locally.

Requirements:

  1. Use Vite + vanilla JavaScript (no TypeScript to keep it simple). Single-page app. No React.
  2. Render with HTML5 Canvas (2D).
  3. Maze generation:
    1. generate a perfect maze using iterative DFS backtracking
    2. default size 25×17 cells, with presets: Small (19×13), Medium (25×17), Large (33×23)
    3. provide a “New Maze” button
  4. Gameplay:
    1. start at top-left cell, goal at bottom-right
    2. move with arrow keys or WASD (one cell per keypress)
    3. prevent moving through walls
    4. track steps and elapsed time; show best time per size in localStorage
  5. Helpers:
    1. “Hint” button: highlight the next 3 steps on the shortest path (BFS)
    2. “Show Path” toggle: draw the full shortest path polyline (BFS) from player to goal
    3. compute BFS only when the player moves or when toggles change
  6. UI:
    1. HUD above canvas: size, time, steps, best time
    2. buttons: New Maze, Reset, Hint, Show Path, Size selector
  7. Deliverables:
    1. minimal Vite project with README.md run instructions
  8. Verification:
    1. run npm install and npm run dev once to confirm it starts.
  9. Keep the project compact, readable, and stable across browsers.
Build Mode on: you can input your prompt

Run locally

After OpenCode generates the project:

npm install
npm run dev

Open the local URL printed by Vite (usually http://localhost:5173) and confirm:

  • The maze renders with a clear start and goal
  • Movement works via WASD / Arrow keys
  • The HUD updates time and steps
  • Hint and Show Path work as expected
  • New Maze regenerates a fresh layout
Demo is finished

OpenCode Beyond the Terminal: Desktop App + IDE Integrations

OpenCode is often used in the terminal, but you can also run it as a Desktop app (Beta) or inside your IDE—and in both cases, you can keep using Novita AI’s OpenAI-compatible API. The interface changes, but the model/provider setup stays the same: select minimax/minimax-m2.1.

Desktop app

OpenCode’s Desktop build is available for macOS, Windows, and Linux. If you prefer a standalone UI for longer agent sessions, the Desktop app is a great fit—and it can use the same provider configuration you already created for Novita AI.

OpenCode Desktop
OpenCode Desktop

IDE integrations

OpenCode provides official integration flows for:

  • VS Code
  • Cursor
  • Zed
  • Windsurf
  • VSCodium

Conclusion

OpenCode makes agentic coding easy to adopt, and MiniMax M2.1 on Novita AI is a practical model choice for multi-step development workflows. With strong benchmark performance and a large context window, it works well for repo-level tasks like implementing features, running checks, and iterating quickly—directly from your terminal, desktop app, or IDE

Novita AI is an AI cloud platform that offers developers an easy way to deploy AI models using our simple API, while also providing affordable and reliable GPU cloud for building and scaling.

Frequently Asked Questions

What is OpenCode?

OpenCode is an open-source AI coding agent framework that lets LLMs write, run, and debug code inside a real development environment, speeding up end-to-end builds.

Is OpenCode Safe?

Yes, OpenCode does not store any of your code or context data, so that it can operate in privacy sensitive environments.

Can OpenCode connect to a custom API?

Yes, OpenCode can integrate with custom APIs, so you can point it to your own model endpoints—for example, using Novita AI’s API to run LLM-powered coding agents with scalable GPU infrastructure.


Discover more from Novita

Subscribe to get the latest posts sent to your email.

Leave a Comment

Scroll to Top

Discover more from Novita

Subscribe now to keep reading and get access to the full archive.

Continue reading