IDE Integration

opencode Integration

Bring Ask Sage AI directly into VS Code with the opencode extension and CLI

Use opencode for VS Code with Ask Sage as your AI provider — all inference stays within your organization's approved instance.


Table of Contents
  1. Prerequisites
  2. Installation
    1. Step 1: Install the opencode CLI
    2. Step 2: Install the VS Code Extension
  3. Configuration
    1. Claude Model Configuration
    2. Using Environment Variables for the API Key
  4. Privacy & Non-Essential Traffic
  5. Launching opencode in VS Code
  6. Activation & Testing
  7. Features & Capabilities
  8. Troubleshooting
  9. Additional Resources

Instance-Specific Base URL: The endpoints and configuration shown reflect the instance at chat.asksage.ai. The api. prefix and path suffix stay the same across deployments — only the instance segment in the middle changes based on which Ask Sage instance you are logging into. Always use the instance approved by your organization and applicable regulatory requirements, and match the base URL in your configuration to the instance you authenticate against.


Prerequisites

Prerequisites

Before you begin, ensure you have the following:

Ask Sage Account

Sign up or log in

opencode CLI

Install from opencode.ai

VS Code Extension

Install from the VS Code Marketplace


Installation

Step 1: Install the opencode CLI

Install opencode CLI

opencode is a terminal-based AI coding agent. Install it via npm or your preferred package manager:

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

Verify the installation:

opencode --version

Step 2: Install the VS Code Extension

Install VS Code Extension

1

Open Extensions

Open the Extensions panel in VS Code (Ctrl+Shift+X / Cmd+Shift+X)

2

Search opencode

Search for "opencode" by SST

3

Install

Click Install on the opencode extension by SST

Direct Install: You can also install via the VS Code Marketplace page or run code --install-extension sst-dev.opencode from your terminal.

Configuration

Claude Model Configuration


Using Environment Variables for the API Key

Secure API Key Storage

To avoid storing your API key in plaintext inside opencode.json, use opencode's environment variable substitution syntax:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "asksage/gpt-5.5",
  "provider": {
    "asksage": {
      "npm": "@ai-sdk/openai",
      "name": "Ask Sage",
      "options": {
        "baseURL": "https://api.asksage.ai/server/openai/v1",
        "apiKey": "{env:ASKSAGE_API_KEY}"
      },
      "models": {
        "gpt-5.5": {
          "name": "GPT-5.5",
          "limit": { "context": 128000, "output": 16384 }
        }
      }
    }
  }
}

Then export the key in your shell profile or session before launching opencode:

export ASKSAGE_API_KEY="your-api-key-here"

Privacy & Non-Essential Traffic

Disabling Non-Essential Traffic

By default, opencode can make outbound connections beyond model inference — for update checks, session sharing, and local network discovery. In regulated environments, add the following fields to opencode.json to restrict traffic to Ask Sage only:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "asksage-claude/google-claude-48-opus",
  "autoupdate": false,
  "share": "disabled",
  "server": {
    "mdns": false
  },
  "provider": {
    ...
  }
}

autoupdate: false

Disables update checks to opencode.ai and GitHub on startup

share: "disabled"

Prevents conversation uploads via the /share command

server.mdns: false

Disables mDNS broadcast for local network service discovery

Note: These settings do not affect model inference — all AI requests still route through your configured Ask Sage provider. Install, package, schema, and extension surfaces (npm, VS Code Marketplace, opencode.ai) are outside the scope of these flags and should be managed via your organization's network controls.

Launching opencode in VS Code

Keyboard Shortcuts

Once installed, the VS Code extension provides keyboard shortcuts to launch opencode directly inside your editor:

Open / Focus

Ctrl+Esc (Windows/Linux)
Cmd+Esc (Mac)

New Session

Ctrl+Shift+Esc (Windows/Linux)
Cmd+Shift+Esc (Mac)

Insert File Reference

Alt+Ctrl+K (Windows/Linux)
Cmd+Option+K (Mac)

Context Awareness: The extension automatically passes your current selection or active tab to opencode when you open a new session, so you can immediately ask questions about the code you're looking at.

Activation & Testing

Verify Your Setup

1

Save Configuration

Save your opencode.json file to your project root or global config directory

2

Restart the Extension

After saving opencode.json, reload VS Code (Developer: Reload Window from the Command Palette) so the extension picks up the new config

3

Open opencode

Press Ctrl+Esc (Windows/Linux) or Cmd+Esc (Mac) to launch opencode in a split terminal

4

Verify the Model

The header should display your configured Ask Sage model (e.g., Ask Sage / GPT-5)

5

Send a Test Prompt

Type a question and press Enter to confirm responses are flowing through Ask Sage

Quick Test Prompt

What model are you running on?

If you receive a coherent response, your Ask Sage provider is configured correctly.


Features & Capabilities

Features & Capabilities

Agentic Chat

Multi-turn AI conversations with full codebase context

In-place Edits

AI applies code changes directly to your files

Git-Aware

Snapshot and restore state across sessions

Multiple Models

Switch between all Ask Sage models in one config

Governed Inference

All configured model inference traffic routes through your Ask Sage instance


Troubleshooting

Troubleshooting

Issue: Authentication Error / Invalid API Key

opencode returns a 401 or authentication failure

Solutions:

  • ✅ Verify your Ask Sage API key is correct (no extra spaces or newlines)
  • ✅ If using {env:ASKSAGE_API_KEY}, confirm the variable is exported in the shell where VS Code was launched
  • ✅ Confirm the key has not expired — regenerate from your Ask Sage account settings if needed
Issue: Model Not Found

opencode reports the model is unavailable

Solutions:

  • ✅ Confirm the model key in opencode.json exactly matches the key used by your Ask Sage instance (check via the Ask Sage /get-models endpoint)
  • ✅ Ensure the "model" top-level field uses the format asksage/<model-key>
  • ✅ Verify the model is enabled on your tenant
Issue: Connection / Base URL Error

Requests fail to reach the Ask Sage API

Solutions:

  • ✅ Double-check the baseURL matches your organization's Ask Sage instance
  • ✅ Ensure the trailing slash is present: https://api.asksage.ai/server/
  • ✅ Check firewall or proxy settings — opencode must be able to reach the API endpoint
  • ✅ If on a government network, confirm you are connected to the required VPN
Issue: Extension Doesn't Launch opencode

Keyboard shortcut opens a terminal but opencode doesn't start

Solutions:

  • ✅ Confirm opencode is in your system PATH (run opencode --version in a terminal)
  • ✅ Restart VS Code after installing the CLI so the updated PATH is picked up
  • ✅ On Windows, ensure the npm global bin directory is in your PATH

Additional Resources

Documentation & Support

Documentation

Support

Need Help?

If you encounter issues not covered here, reach out to support@asksage.ai with:

  • Your OS and VS Code version
  • opencode CLI version (opencode --version)
  • Relevant error messages from the opencode terminal output
  • Your opencode.json (with API key redacted)

Back to top

Copyright © 2026 Ask Sage Inc. All Rights Reserved. Ask Sage is a BigBear.ai company.