Install and configure OpenCode
Install OpenCode on macOS, Linux or Windows and connect it to NaviGator AI Toolkit
OpenCode is an open-source coding agent that runs in your terminal. It reads your project, proposes a plan, edits files and runs commands, using a NaviGator AI model. Prefer a desktop window? See OpenCode Desktop. Both read the same configuration.
What you need
- Your NaviGator AI Toolkit key stored as
NAVIGATOR_TOOLKIT_API_KEY. See Store your key. - A model your key can use. These steps use
gpt-oss-120b, which runs in UF data centers and is approved for Open, Sensitive and Restricted data. - A project in a Git repository. Git is how you review and undo the agent's changes.
- On Windows, Windows Subsystem for Linux (WSL) is recommended.
Install OpenCode
Install with Homebrew:
brew install anomalyco/tap/opencodeOr use the install script:
curl -fsSL https://opencode.ai/install | bashConfirm the install:
opencode --versionConnect OpenCode to NaviGator AI Toolkit
Put the provider in your global configuration so every project can use it. Create the file:
mkdir -p ~/.config/opencode touch ~/.config/opencode/opencode.json open -e ~/.config/opencode/opencode.jsonDownload the starter file and save it there, or paste the configuration below:
opencode.jsonOpenCode configuration for NaviGator AI Toolkit. Reads your key from NAVIGATOR_TOOLKIT_API_KEY.Download opencode.jsonopencode.json { "$schema": "https://opencode.ai/config.json", "enabled_providers": ["navigator"], "model": "navigator/gpt-oss-120b", "small_model": "navigator/gpt-oss-120b", "provider": { "navigator": { "npm": "@ai-sdk/openai-compatible", "name": "NaviGator AI Toolkit", "options": { "baseURL": "https://api.navigator.ai.ufl.edu/v1", "apiKey": "{env:NAVIGATOR_TOOLKIT_API_KEY}" }, "models": { "gpt-oss-120b": { "name": "GPT OSS 120B", "reasoning": true, "modalities": { "input": ["text"], "output": ["text"] }, "limit": { "context": 128000, "output": 0 } } } } }, "permission": { "edit": "allow", "bash": { "*": "ask", "git status*": "allow", "git diff*": "allow", "git log*": "allow", "git push*": "deny" }, "webfetch": "ask", "websearch": "ask" } }enabled_providerslimits OpenCode to NaviGator AI Toolkit, so your work cannot go to another AI service by accident.{env:NAVIGATOR_TOOLKIT_API_KEY}reads your stored key, so the key never appears in the file.permissionlets OpenCode edit files, asks before it runs commands or uses the web, allows read-only Git commands and never lets it push.modelslists the models OpenCode offers. To add another, copy thegpt-oss-120bentry with the exact model ID and its context length from its model page."output": 0lets OpenCode choose the output limit.
Choose the model and test
Start OpenCode in your project:
cd path/to/your-project opencodeEnter
/modelsand confirm GPT OSS 120B under NaviGator AI Toolkit is selected.
Then ask a question that changes nothing:
Read this project and tell me what it does and how to run its tests. Don't change anything.The answer should describe your project, and the footer should show the NaviGator AI Toolkit model.
Give the project its rules
An
AGENTS.mdStarter project rules for a coding agentDownload AGENTS.mdAGENTS.mdfile at the project root tells the agent how to build, test and behave in this codebase. Enter/initand OpenCode reads the project and writes one. Review it and add anything it missed. Or start from this file:AGENTS.md ## How to work - Make small, focused changes. One task at a time. - Before editing, explain the plan in a few lines. - After editing, run the tests and report the result. - Don't add new dependencies without asking. - Don't commit, push or change Git history. ## Boundaries - Never read or print .env files, keys or credentials.
Basic use
| Control | Action |
|---|---|
Tab | Switch between the Plan and Build agents |
@ | Find and reference a project file |
/models | Change the model |
/new | Start a new session |
/sessions | Open an earlier session |
/undo and /redo | Undo or restore the last message and its file changes |
/init | Create or update AGENTS.md |
Ctrl+P | Open the command palette |
Escape | Interrupt the current response |
Use Plan to explore and agree on an approach. It asks before any edit or command. Switch to Build with Tab once the plan looks right.
When OpenCode asks to run a command, choose Once to allow that request, Always to allow matching requests for the rest of the session or Reject to refuse it. Use Always only for commands you have read and understand.
Work in small steps: plan, change one thing, run the tests, read git diff yourself, then commit it yourself.
Work safely
- Start a new branch before letting the agent edit:
git switch -c ai/short-task-name.git diffshows what changed, andgit restore .discards uncommitted changes. - Open unfamiliar projects read-only. OpenCode loads a project's configuration, plugins and instructions as soon as it starts, before you type anything. For code you did not write, use the read-only profile below and see Open an unfamiliar project.
- Keep commits and pushes for yourself. Editing files is not permission to commit, push or deploy.
- Know what the key can reach. OpenCode, its plugins and the commands it runs can read
NAVIGATOR_TOOLKIT_API_KEY. Install only plugins you have reviewed.
For the full operating loop, see Operate coding agents safely. For stronger isolation, run OpenCode in a Docker Sandbox.
Read-only profile
Replace the permission block with this when you only want OpenCode to read and search. It denies editing, commands, the web and anything outside the project. It also keeps .env files unreadable:
"permission": {
"*": "deny",
"read": {
"*": "allow",
"*.env": "deny",
"*.env.*": "deny",
"*.env.example": "allow"
},
"glob": "allow",
"grep": "allow",
"lsp": "allow",
"question": "allow"
}Restart OpenCode after changing the profile.
Other ways to store the key
Store it in OpenCode
OpenCode can keep the key in its own credential file instead of your environment, so other programs started from your terminal cannot read it.
- Remove the
"apiKey"line fromopencode.json. - Start OpenCode in a folder outside any project with
opencode --pure, which skips plugins. - Enter
/connect, select Other, enternavigatoras the provider ID and paste your key.

To remove it later, run opencode auth logout. This removes the key from your computer but does not revoke it.
For one terminal session
Read the key through a hidden prompt as shown in Getting Started, then run opencode in the same terminal.
Troubleshooting
| Problem | What to do |
|---|---|
OpenCode won't start after editing opencode.json | The file has a JSON error. Run opencode debug config to see it, fix the file and start again |
NaviGator AI Toolkit doesn't appear in /models | Open a new terminal so NAVIGATOR_TOOLKIT_API_KEY loads, then start OpenCode from it |
A model is missing from /models | Add it under models with its exact ID, and check your key includes it |
401 or an authentication error | The key is missing, expired or revoked. Check it loads as shown in Store your key |
| The agent edits things you didn't ask for | Name the files in your request, and add the boundary to AGENTS.md |
| Changes went wrong | /undo, or git restore . to discard uncommitted changes |