Cline + MegaBrain Gateway
Cline (formerly Claude Dev) is an autonomous coding agent that lives inside VS Code. It reads and writes files, runs terminal commands, browses the web, and iterates on your codebase without hand-holding. By default it only supports Anthropic models — but with MegaBrain Gateway as the provider you unlock 500+ models from OpenAI, Google, Meta, Mistral, and more, all billed through a single API key.
500+ models
Switch between Claude, GPT-4o, Gemini, Llama, Mistral, and dozens more without leaving Cline.
No per-seat cost
Pay only for tokens consumed. No $20/mo Claude Pro subscription required per developer.
Unified billing
One invoice for every model your whole team uses — across Cline, Cursor, Claude Desktop, and the API.
Prerequisites
- ✓Cline VS Code extension — install saoudrizwan.claude-dev from the VS Code Marketplace (or search
Clinein the Extensions sidebar). - ✓MegaBrain API key — generate one from your profile page. Keys start with
mb-. - ✓VS Code 1.80+ — Cline requires a reasonably modern VS Code release. Run
code --versionto check.
Setup
Install Cline
Open the Extensions sidebar in VS Code (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows/Linux), search for Cline, and install the extension published by saoudrizwan. The extension id is saoudrizwan.claude-dev.
After installation a robot icon appears in the activity bar on the left. Click it to open the Cline panel.
Open Cline Settings
Click the Cline robot icon in the VS Code activity bar to open the panel, then click the gear icon (⚙) in the top-right corner of the panel. This opens the Cline provider configuration screen.
Cmd+Shift+P → Cline: Open Settings.Select provider — OpenAI Compatible
In the API Provider dropdown, scroll down and select OpenAI Compatible. This mode lets Cline talk to any server that speaks the OpenAI Chat Completions protocol — including MegaBrain Gateway.
Enter MegaBrain credentials
Fill in the three fields that appear after selecting OpenAI Compatible:
| Field | Value |
|---|---|
| Base URL | https://getmegabrain.com/api/gateway/v1 |
| API Key | mb-•••••••• (your key from the profile page) |
| Model ID | anthropic/claude-sonnet-4-6 |
You can change the Model ID at any time. See the recommended models section below for good starting points.
Click Done and start a task
Click Done to save. Cline will immediately verify the credentials by fetching the model list from MegaBrain. If the connection succeeds the panel shows a text field where you can type your first task.
For a distraction-free experience, open Cline in its own editor tab:
Cmd+Shift+P → Cline: Open in New TabHow Cline works
Understanding the agentic loop helps you write better task prompts and know when to intervene.
Agentic loop
Cline sends your task to the model, receives a response that may include tool calls, executes those calls, feeds results back, and repeats — up to the context limit or until the task is done.
Tool use
Out of the box Cline can read/write files, run terminal commands, search the web, and use the VS Code API to open diffs. Each tool call is shown in the panel before execution.
Plan mode vs Act mode
In Plan mode Cline thinks through an approach and shows you the plan before touching any file. In Act mode it executes immediately. Toggle in the bottom toolbar.
Diff review
Before applying any file edit Cline opens a diff view in VS Code. You can accept, reject, or edit the proposed change. Nothing lands in your repo without your sign-off.
Recommended models
Paste any of these into the Model ID field in Cline settings. You can switch models between tasks without reconfiguring the base URL or API key.
# Best overall for agentic coding tasks
anthropic/claude-sonnet-4-6
# Deepest reasoning — slower, higher cost
anthropic/claude-opus-4-5
# Fast iteration and quick edits
openai/gpt-4o
# Budget pick with strong tool-use support
google/gemini-2.5-flashBrowse the full catalogue on the Models page. Any model that supports tool use works with Cline.
Troubleshooting
▶401 Unauthorized — API key rejected
Double-check that the key starts with mb- and was copied in full (no trailing space). Keys are shown once at creation; generate a new one from your profile if needed. Make sure the Base URL is exactly https://getmegabrain.com/api/gateway/v1 with no trailing slash.
▶Model not found / 404 on the model ID
Model IDs are case-sensitive and follow the provider/name format, e.g. anthropic/claude-sonnet-4-6. Open the Models page to copy the exact ID. If you pasted from somewhere else, check for invisible characters.
▶Responses are slow or time out
Large context windows and long agentic loops take time. Try a faster model like openai/gpt-4o or google/gemini-2.5-flash for quicker iteration. You can also break the task into smaller steps to keep the context window manageable.
▶Cline shows a model picker with only Anthropic models
This means Cline is still in Anthropic provider mode, not OpenAI Compatible mode. Go back to settings (⚙), confirm the API Provider dropdown shows OpenAI Compatible, and that the Base URL field is filled in — it only appears after you select that provider.
▶Tool calls fail or Cline loops without making progress
Some smaller models do not follow the OpenAI tool-calling spec reliably. Switch to a model with strong tool-use support (Claude Sonnet, GPT-4o, or Gemini 2.5 Flash). Also check that Cline has the necessary VS Code permissions for file access in your workspace.