NaviGator AI

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.
  1. Install OpenCode

    Install with Homebrew:

    brew install anomalyco/tap/opencode

    Or use the install script:

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

    Confirm the install:

    opencode --version
  2. Connect 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.json

    Download 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.json
    opencode.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_providers limits 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.
    • permission lets OpenCode edit files, asks before it runs commands or uses the web, allows read-only Git commands and never lets it push.
    • models lists the models OpenCode offers. To add another, copy the gpt-oss-120b entry with the exact model ID and its context length from its model page. "output": 0 lets OpenCode choose the output limit.
  3. Choose the model and test

    Start OpenCode in your project:

    cd path/to/your-project
    opencode

    Enter /models and confirm GPT OSS 120B under NaviGator AI Toolkit is selected.

    OpenCode model selector filtered to GPT OSS 120B under NaviGator AI Toolkit

    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.

  4. Give the project its rules

    An AGENTS.md file at the project root tells the agent how to build, test and behave in this codebase. Enter /init and OpenCode reads the project and writes one. Review it and add anything it missed. Or start from this file:

    AGENTS.mdStarter project rules for a coding agentDownload AGENTS.md
    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

ControlAction
TabSwitch between the Plan and Build agents
@Find and reference a project file
/modelsChange the model
/newStart a new session
/sessionsOpen an earlier session
/undo and /redoUndo or restore the last message and its file changes
/initCreate or update AGENTS.md
Ctrl+POpen the command palette
EscapeInterrupt 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 diff shows what changed, and git 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.

  1. Remove the "apiKey" line from opencode.json.
  2. Start OpenCode in a folder outside any project with opencode --pure, which skips plugins.
  3. Enter /connect, select Other, enter navigator as the provider ID and paste your key.

OpenCode credential dialog with navigator entered as the custom provider ID

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

ProblemWhat to do
OpenCode won't start after editing opencode.jsonThe 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 /modelsOpen a new terminal so NAVIGATOR_TOOLKIT_API_KEY loads, then start OpenCode from it
A model is missing from /modelsAdd it under models with its exact ID, and check your key includes it
401 or an authentication errorThe key is missing, expired or revoked. Check it loads as shown in Store your key
The agent edits things you didn't ask forName the files in your request, and add the boundary to AGENTS.md
Changes went wrong/undo, or git restore . to discard uncommitted changes

References

On this page