OPENCODE · SETUP GUIDE
Connect OpenCode to Antigravity Manager
Connect OpenCode to Manager’s API proxy with a dedicated provider and your gateway key. Use Sync Config Now for a local installation, or add the provider manually on the computer running OpenCode. Then select a model and try a reply and a file read.
Antigravity Tools 5.0.0 · OpenCode 1.x · Updated
Which connection should you use?
To send OpenCode requests through Manager, choose the antigravity-manager provider. Manager handles the upstream accounts; OpenCode connects with the API key from Manager’s API Proxy page.
| Connection | What you configure | When to use it |
|---|---|---|
| Manager provider | Manager’s address, gateway key and a model under antigravity-manager/…. | You want requests to use Manager’s account pool and routing. Keep the proxy running. |
| opencode-antigravity-auth | The plugin’s OAuth login, Google provider and account pool. | You want the plugin to manage the connection directly. Follow the plugin instructions for your OpenCode version. |
The Manager route works without installing the OAuth plugin. If you already use the plugin, leave its settings in place and select the full antigravity-manager/MODEL_ID reference when using the gateway. You can switch back to the plugin’s own provider and model afterward.
I already use the auth plugin with OpenCode 2.x
The plugin’s OpenCode 2.x migration guide uses plugins, providers and a different variant format. Keep that configuration separate from the OpenCode 1.x examples below. Save your existing settings and check the client’s supported provider schema before connecting Manager.
1. Prepare OpenCode and save your settings
Start Manager’s proxy, confirm a working model, and back up OpenCode’s current configuration before syncing. The proxy setup guide covers starting the service, finding the key and sending the first API request.
- Run
opencode --versionin the terminal where you will use the client. If the command fails, finish the OpenCode installation first. - Close running OpenCode sessions. Open
~/.config/opencode/on macOS or Linux, orC:\Users\<User>\.config\opencode\on Windows. - Save a dated copy of each existing
opencode.jsonandopencode.jsonc. If you use the auth plugin, also save its configuration andantigravity-accounts.jsonprivately. - Note your current provider/model and any custom config location. Keep the copies outside your project repository: settings and account files can contain credentials.
Manager prefers an existing opencode.jsonc in that directory; otherwise it writes opencode.json. Sync accepts JSONC comments and trailing commas, then saves formatted JSON. Your dated copy keeps the original comments and formatting.
My config uses a custom path, project folder or Docker
Manager writes to the home directory of the user running its backend. For a remote server or container, configure OpenCode on the client’s machine using the manual example. See where client sync writes files for the local and server cases.
OpenCode combines global, custom and project configuration. Check OPENCODE_CONFIG, OPENCODE_CONFIG_DIR, OPENCODE_CONFIG_CONTENT, XDG_CONFIG_HOME and any project settings if a change fails to appear. The config locations documentation explains their precedence.
2. Sync the provider from Manager
Open API Proxy → One-Click Agent Tools Configuration and find the OpenCode card. Sync adds Manager’s provider while keeping the other providers in your config.
- Leave Sync accounts to antigravity-accounts.json unchecked for this gateway connection.
- Click Sync Config Now. In Select OpenCode Models, select a text model that already works through your proxy.
- Check Custom Manager BaseURL. For OpenCode and Manager on the same computer, use
http://127.0.0.1:8045/v1, adjusting the port to match your proxy. For another host or container, enter the address reachable from OpenCode. - Click Confirm Sync, then use View Config to inspect the saved settings. Compare them with your dated copy before restarting OpenCode.
OpenCode’s @ai-sdk/anthropic adapter uses a base URL ending in /v1. Keep that suffix once, without appending /messages. The separate Claude Code setup uses the proxy’s root address.
What does “Sync accounts” export?
It writes eligible Manager accounts to antigravity-accounts.json in the plugin’s v3 account format, including OAuth refresh tokens. Enable it only when you intend to import accounts into a compatible auth-plugin setup. A gateway connection needs only the proxy key. Existing account files get an automatic backup when no backup already exists; keep your dated copy too.
If account export fails after the provider has been saved, inspect both files before retrying: the provider change can already be in place.
Configure the provider manually
Add the following provider on the computer running OpenCode when you use a custom config path or a remote Manager. Inside an existing file, merge antigravity-manager into its provider object and keep your other settings.
Replace MODEL_ID with the exact model ID you used for a successful proxy request. Set baseURL to the address OpenCode can reach, with /v1 at the end. The model selection guide explains IDs, account access and routing.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"antigravity-manager": {
"npm": "@ai-sdk/anthropic",
"name": "Antigravity Manager",
"options": {
"baseURL": "http://127.0.0.1:8045/v1",
"apiKey": "{env:AG_OPENCODE_GATEWAY_KEY}"
},
"models": {
"MODEL_ID": { "name": "Gateway model" }
}
}
}
}The {env:AG_OPENCODE_GATEWAY_KEY} value loads your key from the terminal environment. Choose your shell below, run the snippet, and paste the API Proxy key at the hidden prompt. Run subsequent OpenCode commands in that same terminal. Close it when finished.
Bash on macOS, Linux or WSL
read -r -s -p 'Manager API key: ' AG_OPENCODE_GATEWAY_KEY
printf '
'
export AG_OPENCODE_GATEWAY_KEYPowerShell on Windows
$env:AG_OPENCODE_GATEWAY_KEY = [System.Net.NetworkCredential]::new(
'', (Read-Host 'Manager API key' -AsSecureString)
).PasswordThis example supplies a basic model entry for the first connection. Sync Config Now also supplies known models’ limits, input types and reasoning variants. Keep those generated fields when moving a synced provider to another machine. Manager’s sync writes the gateway key directly into the file; it replaces the environment reference if you sync that provider again.
Check the saved configuration
Confirm the provider, address and model in the file OpenCode actually reads. These checks catch a wrong host, an overwritten custom setting or a stale model before you start a coding session.
| Setting | Expected value or action |
|---|---|
| Provider | provider.antigravity-manager with npm set to @ai-sdk/anthropic. |
| Connection | options.baseURL reaches Manager and ends in /v1; options.apiKey supplies your gateway key. |
| Other providers | Compare google, anthropic and any custom providers with your saved copy. |
| Existing Manager models | Sync merges models. Previously added entries can remain after you deselect them. Remove an unwanted entry explicitly from provider.antigravity-manager.models. |
| Custom model fields | For selected catalog models, sync refreshes fields such as limits and variants. Recheck your overrides after syncing. |
| Automatic backup | The first saved backup stays in place across later syncs. Keep a new dated copy before each change you may want to undo. |
Where are the automatic backups?
Look beside the original file in the OpenCode config directory. Depending on which files existed before the change, you may see:
opencode.json.antigravity-manager.bak
opencode.jsonc.antigravity-manager.bak
antigravity-accounts.json.antigravity-manager.bakOlder installations can use the suffix .antigravity.bak. If sync created a brand-new file, there was no original file to back up. Check a backup’s date and contents before using Restore.
3. Select your model and reasoning variant
Run opencode models antigravity-manager to list the configured models, then select one with its full provider/model name. In interactive OpenCode, use /models to switch models.
Choose an ID your Manager account can use. If the gateway rejects it, check model availability and routing. Start with a plain request, then try a reasoning variant listed under that model’s variants field.
| Synced model family | Variants generated by Manager 5.0.0 |
|---|---|
| Claude thinking | low: 8,192 tokens; medium: 16,384; high: 24,576; max: 32,768. |
| Gemini 3 Pro | low and high, using the effort field. Medium and max are disabled. |
| Gemini 3 Flash | low, medium and high, using effort. Max is disabled. |
| Gemini 2.5 Flash Thinking | Token-budget variants. Use the values stored for that specific model. |
These defaults come from Manager’s model configuration. The upstream model can impose additional limits. If a variant causes a budget error, retry the plain request and follow the thinking-budget checks below.
opencode run "Reply with a short hello. Do not use tools." --model antigravity-manager/MODEL_ID --variant high4. Test a reply and two file reads
Send a short request first, then check that OpenCode can read a local file and handle a follow-up in the same conversation. Use an empty test folder so the first tool test stays easy to inspect.
opencode run "Reply with a short hello. Do not use tools." --model antigravity-manager/MODEL_IDWait for a complete greeting and for the command to finish. Find the matching request in Manager’s API Monitor Dashboard to check which model handled it. If the command fails, resolve that error before adding tools or reasoning variants.
- Create an empty folder and add
connection-check.txtwith a short marker of your own, such asorchid-472. - Open a terminal in that folder and run
opencode --model antigravity-manager/MODEL_ID, replacing the model ID. For manual key setup, use the same terminal where you set the key. - Send the first prompt below and allow the file read if OpenCode asks. Check that the tool reads the intended file and that the reply matches its marker.
- Change the marker yourself in your editor, save the file, and send the follow-up in the same conversation. The reply should contain the new marker after another file read.
Use the file-reading tool to read connection-check.txt in this folder. Reply with the marker exactly as written. Leave the file unchanged.Read connection-check.txt again using the file-reading tool. What is the marker now? Leave the file unchanged.Each reply should finish and return control to you. If the first read works but the follow-up stalls or fails, save the smallest example and use the streaming and tool troubleshooting guide. Include the Manager and OpenCode versions and the failed step when reporting the problem.
Remove Manager or restore earlier settings
To disconnect only Manager, close OpenCode, save the current config, and remove the antigravity-manager entry from provider manually. Update any default model or small_model that points to it, then restart and select your previous provider.
Which legacy settings does Clear remove?
It removes a predefined set of older Antigravity model IDs from the Google and Anthropic providers, even when their base URLs differ from Manager’s. If a provider’s base URL matches the current Manager proxy, it also removes that provider’s baseURL and apiKey. The card enables this cleanup automatically.
Restore an automatic backup
Use Restore on the OpenCode card when you want to return to the saved files. Save another copy of your current settings and backups before confirming.
- Manager prefers
.antigravity-manager.bakover the older.antigravity.bakfor the file it is checking. Restore moves the backup into place, so that backup is removed afterward. - Restore can also replace
antigravity-accounts.jsonwhen an account backup exists, regardless of the current Sync accounts checkbox. - If only an account backup exists, Restore can succeed while leaving the provider config unchanged. Inspect both files after it finishes.
- If no eligible backup exists, Manager reports
No backup files found. Use your dated copy or remove the provider manually.
When both JSON and JSONC files are present, restore your intended copy to its original filename and check which file OpenCode loads. If you deleted opencode.jsonc but still have its backup, recover that copy manually. Keep later edits from your current file if the automatic backup predates them.
Fix common OpenCode connection errors
Start with the failing step: config loading, connecting to the proxy, selecting a model, or completing a tool request. Change one setting at a time and repeat the short text request.
- Manager says OpenCode is missing, but it runs in my terminal
- Check the executable path visible to Manager. A desktop app launched before a PATH change may need restarting. With WSL, containers or different user accounts, use the manual configuration in the environment where OpenCode runs.
- The Manager provider or selected model is missing
- Check the active JSON/JSONC file, custom paths and project overrides. Review
enabled_providersanddisabled_providers, then restart OpenCode and runopencode models antigravity-manager. Use the complete provider/model name. - Connection refused, 401, 403 or 404
- Check that Manager is running and that the host and port are reachable from OpenCode. For 401, check the gateway key or missing environment variable; for 403, review the proxy’s access policy. For 404, check the
/v1base URL and the model named in the error. Follow the proxy connection checks. - thinking_budget is out of range, or a variant fails
- Retry the same model without
--variant. If that works, check the enabled variants and reduce the budget within the limit stated by the error. Keep Geminieffortsettings and Claude token budgets in their respective model entries. Record the exact rejected field and version pair; avoid copying a budget limit from a different model. - Sync reports invalid JSON/JSONC
- Save a copy and repair the syntax in the existing file. It must contain a JSON object; check braces, quoted property names and values. Manager leaves an invalid config unchanged. Keep your original backup while fixing it.
- A plain reply works, but a file read or follow-up fails
- Check the file path, permissions and tool approval in OpenCode. Repeat in a new test folder and conversation. If it still fails, record which tool or follow-up broke and consult tool and streaming diagnostics.
- I need to report a problem
- Include versions, the selected provider/model, the failed command and a small reproduction in the Manager issue tracker. Remove API keys, tokens and private file contents from logs and configuration. The diagnostics guide explains what to collect.
Related guides and documentation
Use the AI client connection guide for another application, or return to the setup guide for accounts, quotas and server deployment.
- Manager 5.0.0: OpenCode setup — upstream integration instructions.
- OpenCode configuration — file locations, overrides and environment variables.
- OpenCode providers — provider settings and custom connections.
- OpenCode models and CLI commands — model selection and variants.