MegaBrain University · guide
OpenWork Custom LLM Setup: the Open-Source Claude Cowork Alternative on Any Model
Updated · 10 min setup
Short answer
To use OpenWork with MegaBrain, add a provider to your workspace’s opencode.jsonc with "npm": "@ai-sdk/openai-compatible", baseURL https://getmegabrain.com/api/gateway/v1 and apiKey: "{env:MEGABRAIN_API_KEY}", add the key in Settings → Environment, reload the OpenCode config and pick the model in the chat. OpenWork then does documents, research and files with Claude, GPT-6 or open models on one key.
| Base URL (OpenAI-compatible) | https://getmegabrain.com/api/gateway/v1 |
|---|---|
| Base URL for Claude Code and the Anthropic SDK | https://getmegabrain.com/api/anthropic |
| Key | Authorization: Bearer <key> — the API key page in your dashboard |
| Default model | anthropic/claude-sonnet-5.5 |
| Free model for testing | mb-auto/free |
What is OpenWork
OpenWork is an open-source desktop app for macOS, Windows and Linux, built as an alternative to Claude Cowork. It gives non-developers an agent that works with files and folders, documents, spreadsheets and the web, with shared skills and MCP connections for a team. Under the hood it runs the OpenCode engine.
Because the engine is OpenCode, OpenWork reads OpenCode’s provider config. Any OpenAI-compatible API can be added as a custom LLM, so a team can run OpenWork on MegaBrain with one balance and switch between Claude, GPT and cheaper open models per task.
Setup, step by step
Step 1. Get a MegaBrain API key
Sign up with GitHub, Google or email, add funds on the Balance page and create a key on the API key page. The key works for every text, image and video model, and each request is paid from your balance — no subscription.
Put the key in an environment variable so it never lands in a config file you share:
# ~/.zshrc or ~/.bashrc export MEGABRAIN_API_KEY="your-megabrain-key"curl https://getmegabrain.com/api/gateway/v1/chat/completions \ -H "Authorization: Bearer $MEGABRAIN_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "anthropic/claude-sonnet-5.5", "messages": [{"role": "user", "content": "Say OK"}]}'Check the key before you touch the agent. A JSON reply with
choicesmeans the key, the balance and the model all work:Step 2. Install OpenWork
Download the app for your OS from openworklabs.com/download or the GitHub releases page, install it and open a workspace (a folder the agent will work in).
Step 3. Add MegaBrain as a custom LLM
Create or open
opencode.jsoncin the workspace folder (OpenWork’s docs recommend the workspace file over the global one) and add the provider:{ "$schema": "https://opencode.ai/config.json", "provider": { "megabrain": { "npm": "@ai-sdk/openai-compatible", "name": "MegaBrain", "options": { "baseURL": "https://getmegabrain.com/api/gateway/v1", "apiKey": "{env:MEGABRAIN_API_KEY}" }, "models": { "anthropic/claude-sonnet-5.5": { "name": "Claude Sonnet 5.5", "limit": { "context": 1000000, "output": 32000 } }, "openai/gpt-6.1-sol": { "name": "GPT-6.1 Sol", "limit": { "context": 1050000, "output": 32000 } }, "google/gemini-3.8-flash": { "name": "Gemini 3.8 Flash", "limit": { "context": 1048576, "output": 32000 } } } } } }Step 4. Add the key and reload
In OpenWork open Settings → Environment → Add variable, name it
MEGABRAIN_API_KEYand paste the key (or export it in your shell before starting the app). Then run Reload OpenCode config from the command palette, or restart OpenWork.Step 5. Pick the model and run a task
Open the model picker in the chat, choose MegaBrain → Claude Sonnet 5.5 and give it a task on a file in the workspace, for example “Summarize every PDF in /contracts into one table”.
Which model to choose
OpenWork needs an endpoint that speaks Chat Completions and a model that handles tool definitions; every model below does. Claude Sonnet 5.5 is the best all-rounder for documents; Gemini Flash is a cheaper choice for long spreadsheets and bulk summaries.
| Model ID | When to use it |
|---|---|
anthropic/claude-sonnet-5.5 | The default for an agent: reliable tool calls, holds long tasks, 1M-token context. |
anthropic/claude-opus-5.5 | Hard multi-step work, code review and analysis where a mistake costs more than tokens. |
openai/gpt-6.1-sol | OpenAI's flagship: the alternative to Claude for code and reasoning. |
google/gemini-3.8-flash | Fast and cheap: long documents, spreadsheets, inbox triage. |
moonshotai/kimi-k3.1-pro | A strong open-weight model for agents and code. |
z-ai/glm-5.3 | Open-weight model for code and tools with good price-to-quality. |
deepseek/deepseek-v4.1-flash | High-volume routine work: classification, drafts, summaries. |
mb-auto/free | Free, for checking your setup. 128K context, weaker at tool calls; do not send confidential data. |
Every model with its price and context window is in the catalog. They all work with the same key.
What you can do
Work on your files
Reads and writes documents, spreadsheets and folders in the workspace, so results land as files, not just chat messages.
Shared team skills
Skills and MCP connections can be shared across a team; Claude-compatible skills and plugins carry over.
Self-hosted control plane
Team admins can run OpenWork’s control plane themselves and add custom providers through a form instead of JSON.
Headless mode
openwork-server and a web mode run the same agent without the desktop window.
Business use cases
Contract and document review
Drop a folder of contracts into the workspace; OpenWork extracts parties, dates, amounts and risky clauses into one spreadsheet. Use Claude Opus 5.5 where accuracy matters most.
Task for the agent:
Read every file in ./contracts. Build contracts-summary.xlsx with columns: file, counterparty, signing date, end date, total amount, payment terms, auto-renewal (yes/no), unusual clauses. Flag anything that looks risky in a separate column.Weekly report from raw exports
Finance or ops exports CSVs from several systems; OpenWork merges them, computes the weekly metrics and writes a two-page report in the house template.
Market research pack
Ask for a competitor overview: the agent searches the web, saves sources and produces a brief with a comparison table — ready to edit, not to retype.
Marketing assets in bulk
Give it a product sheet and the brand guide; it writes descriptions for every product and, through MegaBrain’s image API, makes the matching visuals.
Troubleshooting
401 Unauthorized
The key is missing or mistyped, or the agent did not read the environment variable (restart the agent after export). Test the key with the curl command from step 1.
402 Payment Required
The balance is empty. Add funds on the Balance page, or switch to mb-auto/free to keep testing.
Model not found
The model ID must match the catalog exactly, including the lab prefix: anthropic/claude-sonnet-5.5, not claude-sonnet-5.5. The base URL must end in /v1.
The MegaBrain models do not show up in the picker
Check the JSON is valid, that it is in the workspace’s opencode.jsonc, then run Reload OpenCode config. Your organization’s OpenWork policy can also block custom providers.
The agent answers but does not touch files
The model must support tool calling. Switch to one from the table, e.g. anthropic/claude-sonnet-5.5.
FAQ
Is OpenWork the same as Claude Cowork?
No. OpenWork is an independent open-source project inspired by Claude Cowork. Unlike Cowork it is not tied to one vendor: with MegaBrain it runs on Claude, GPT, Gemini or open models.
Does OpenWork use the OpenCode config format?
Yes. It runs the OpenCode engine, so custom providers go in opencode.jsonc with @ai-sdk/openai-compatible, exactly as in our OpenCode guide.
How much does it cost?
You pay per token at each model’s price, from a prepaid balance in US dollars topped up by card. There is no subscription and no seat fee, so an agent that sits idle costs nothing. Prices per million tokens are in the model catalog; mb-auto/free costs nothing at all.
Do I need separate Anthropic, OpenAI or Google accounts?
No. One MegaBrain key reaches Claude, GPT, Gemini, Grok, Kimi, GLM, DeepSeek, Qwen and MiniMax. You switch models by changing the model ID, not the provider or the key.
Can a whole team share one balance?
Each person uses their own MegaBrain key and the requests are paid from that account’s balance; the usage of every key is visible in the dashboard.
MegaBrain · one API for every model
Claude, GPT, Gemini, Kimi, GLM and DeepSeek in any agent — one key, one balance.
Sign up, add funds by card and pay only for what your agents use. No subscription. Free models work without a key.