---
title: Use Savant in a coding agent
description: Use SubQ Savant as the model in OpenCode, VS Code, and other coding agents.
---

Any coding agent with an OpenAI-compatible (Chat Completions) provider setting
can run on SubQ Savant (Preview) using these three
values:

| Setting  | Value                    |
| -------- | ------------------------ |
| Base URL | `https://api.subq.ai/v1` |
| API key  | Your SubQ API key        |
| Model    | `subq-savant-latest`     |

## OpenCode

1. [Save your API key](/#save-your-api-key) as `SUBQ_API_KEY`.

2. Add SubQ as a provider in `opencode.jsonc` at the root of your project. To
   use it in every project, put it in `~/.config/opencode/opencode.jsonc`
   instead. This uses the OpenCode 2 config format.

   ```jsonc title="opencode.jsonc" expand
   {
     "$schema": "https://opencode.ai/config.json",
     "model": "subq/subq-savant-latest",
     "providers": {
       "subq": {
         "name": "SubQ",
         "env": ["SUBQ_API_KEY"],
         "package": "@opencode/ai/providers/openai-compatible",
         "settings": {
           "baseURL": "https://api.subq.ai/v1",
         },
         "models": {
           "subq-savant-latest": {
             "name": "SubQ Savant",
             // OpenCode assumes 200K tokens for models it doesn't know.
             "limit": { "context": 4000000 },
           },
         },
       },
     },
   }
   ```

3. Give the key to OpenCode's background server, which doesn't see your
   shell's variables. Without this, requests fail with a missing-authentication
   error.

   ```bash
   opencode service set env SUBQ_API_KEY "$SUBQ_API_KEY"
   ```

4. Run a quick check from your project root to verify end-to-end setup:

   ```bash
   opencode run "Review this repository for error-handling gaps, edge cases, and maintainability issues, and list the highest-impact fixes."
   ```

## VS Code

These steps use the chat built into VS Code (GitHub Copilot) and require VS Code
1.142 or newer. On Copilot Business or Enterprise, an admin must first allow
**Bring Your Own Language Model Key in VS Code**.

1. Open **Chat: Chat Settings** from the Command Palette and check
   `chat.agentHost.byokModels.enabled`. If it isn't already enabled, turn it on
   and restart VS Code.

2. Open **Chat: Manage Language Models** from the Command Palette, select
   **Add Models**, and choose **Custom Endpoint**.

3. Enter `SubQ` as the group name, add a display name, enter your SubQ API key,
   and select **Chat Completions** as the API type.

4. VS Code opens `chatLanguageModels.json`. In the `SubQ` group, set the
   `models` array to this; leave the rest of the file as is:

   ```json expand
   "models": [
     {
       "id": "subq-savant-latest",
       "name": "SubQ Savant",
       "url": "https://api.subq.ai/v1/chat/completions",
       "toolCalling": true,
       "vision": true,
       "thinking": true,
       "maxInputTokens": 3872000,
       "maxOutputTokens": 128000
     }
   ]
   ```

   - `maxInputTokens` and `maxOutputTokens` add up to Savant's 4M context.
   - `thinking` stops VS Code from sending a `temperature`, which Savant
     rejects unless it's `1`.
   - Don't add a key here. The file's own `apiKey` line already points to the
     key from step 3.

5. Confirm the session target below the chat input is set to **Copilot**. Open
   the model picker in the chat input (for example, from **Copilot Fusion**),
   switch to the **SubQ** tab at the top, and select **SubQ Savant**.

6. Run a quick check in chat to verify end-to-end setup:

   ```text
   Review this repository for error-handling gaps, edge cases, and maintainability issues, and list the highest-impact fixes.
   ```
