# Roo Code (https://inference.net/docs/integrations/roo-code)

Connect Roo Code in VS Code to Inference.net by selecting the **OpenAI Compatible** API provider, setting **Base URL** to `https://api.inference.net/v1`, pasting your API key, and entering a verified tool-calling model ID such as `deepseek-v4.1-flash-1017`, `glm-5.3`, or `moonshotai/kimi-k3.1-pro`.

## Quick configuration

Create a free account at [/register](/register/?model=deepseek-v4.1-flash-1017) and generate a project key in [API keys](/dashboard/api-keys/). Enter these values in Roo Code's provider settings:

| Roo Code setting | Value |
| --- | --- |
| API Provider | `OpenAI Compatible` |
| Base URL | `https://api.inference.net/v1` |
| US-only Base URL (optional) | `https://us.api.inference.net/v1` |
| API Key | Your Inference.net API key (`inf_sk_...`) |
| Model ID | `deepseek-v4.1-flash-1017` (or any verified tool model below) |
| Custom Header (optional) | `x-inference-task-id: roo-code` |

## Set up Roo Code in VS Code

<Steps>
<Step title="Open Roo Code provider settings">

Open the Roo Code panel in VS Code and click the **Settings** (gear) icon to open API Configuration Profiles.

</Step>
<Step title="Create an OpenAI Compatible profile">

Create a new profile (for example, `inference-deepseek`) and set **API Provider** to **OpenAI Compatible**.

</Step>
<Step title="Set Base URL and API key">

Set **Base URL** to:

```text
https://api.inference.net/v1
```

Use `https://us.api.inference.net/v1` to pin requests to US-hosted GPU clusters for US-served models (marked with the `US` badge in the [model catalog](/models/)). Paste your key from [API keys](/dashboard/api-keys/) into **API Key**.

</Step>
<Step title="Enter exact Model ID, context limits, and pricing">

Enter `deepseek-v4.1-flash-1017` in **Model**, then expand **Model Configuration** and set:

- **Context Window Size:** `1040000`
- **Max Output Tokens:** `393216`
- **Supports Images:** Enabled (for `deepseek-v4.1-flash-1017`, `glm-5.3-flash`, `moonshotai/kimi-k3`, and `moonshotai/kimi-k3.1-pro`)
- **Supports Prompt Cache:** Enabled
- **Input Price / Output Price / Cache Reads Price ($/1M):** `0.08` / `0.635` / `0.007`

</Step>
<Step title="Optional: tag requests for dashboard filtering">

Under **Custom Headers**, add `x-inference-task-id` with value `roo-code` so you can filter Roo Code requests and cached tokens on the [Usage](/dashboard/usage/) page.

</Step>
<Step title="Save and bind profiles to Roo modes">

Save the profile and bind separate profiles to **Architect**, **Code**, and **Debug** modes from the mode selector (for example, `inference-kimi-pro` or `inference-glm` for Architect and `inference-deepseek` for Code and Debug).

</Step>
</Steps>

## Copy-paste JSON profiles for Roo Code

Roo Code lets you import and export JSON provider profiles. Save the snippet below locally, replace `inf_sk_...` with your real API key, and import it in Roo Code Settings. Never commit API keys to git.

```json
{
  "providerProfiles": {
    "currentApiConfigName": "inference-deepseek",
    "apiConfigs": {
      "inference-deepseek": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "deepseek-v4.1-flash-1017",
        "openAiHeaders": {
          "x-inference-task-id": "roo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1040000,
          "maxTokens": 393216,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 0.08,
          "outputPrice": 0.635,
          "cacheReadsPrice": 0.007
        }
      },
      "inference-kimi-pro": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "moonshotai/kimi-k3.1-pro",
        "openAiHeaders": {
          "x-inference-task-id": "roo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 1048576,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 1.8,
          "outputPrice": 9.0,
          "cacheReadsPrice": 0.198
        }
      },
      "inference-kimi": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "moonshotai/kimi-k3",
        "openAiHeaders": {
          "x-inference-task-id": "roo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 1048576,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 0.245,
          "outputPrice": 15.0,
          "cacheReadsPrice": 0.224
        }
      },
      "inference-glm": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "glm-5.3",
        "openAiHeaders": {
          "x-inference-task-id": "roo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 943718,
          "supportsImages": false,
          "supportsPromptCache": true,
          "inputPrice": 0.084,
          "outputPrice": 3.0,
          "cacheReadsPrice": 0.079
        }
      },
      "inference-glm-flash": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "glm-5.3-flash",
        "openAiHeaders": {
          "x-inference-task-id": "roo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 262144,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 0.1,
          "outputPrice": 0.35,
          "cacheReadsPrice": 0.03
        }
      }
    }
  }
}
```

## Verified tool-calling models for Roo Code

Roo Code depends on tool calling to read workspace files, apply diffs, and run terminal commands. All models below expose `supports_tools: true` and Inference.net-hosted US routing in `GET https://api.inference.net/v1/models` (verified 2026-12-06):

| Model ID | Context / max output | Fresh / Cached / Output ($/1M) | Image input | Model page |
| --- | ---: | --- | --- | --- |
| `deepseek-v4.1-flash-1017` | 1,040,000 / 393,216 | `$0.08` / `$0.007` / `$0.635` | Yes | [DeepSeek V4.1 Flash](/models/deepseek-v4-1-flash-1017/) |
| `glm-5.3-flash` | 1,048,576 / 262,144 | `$0.10` / `$0.03` / `$0.35` | Yes | [GLM-5.3 Flash](/models/glm-5-3-flash/) |
| `glm-5.3` | 1,048,576 / 943,718 | `$0.084` / `$0.079` / `$3.00` | No | [GLM-5.3](/models/glm-5-3/) |
| `moonshotai/kimi-k3.1-pro` | 1,048,576 / 1,048,576 | `$1.80` / `$0.198` / `$9.00` | Yes | [Kimi K3.1 Pro](/models/kimi-k3-1-pro/) |
| `moonshotai/kimi-k3` | 1,048,576 / 1,048,576 | `$0.245` / `$0.224` / `$15.00` | Yes | [Kimi K3](/models/kimi-k3/) |

<Callout title="Avoid non-tool models in Roo Code" tone="warning">

Models with `supports_tools: false` (such as `inference-net/schematron-v2-turbo` or `glm-5`) cannot drive Roo Code's edit and command loop. Always verify `supports_tools: true` in `GET https://api.inference.net/v1/models` or browse the [model catalog](/models/).

</Callout>

## Prompt caching and Zero Data Retention tips

- **Keep `.roo/rules` and MCP servers steady mid-task:** Roo Code replays its mode instructions, workspace rules, and tool definitions on every turn. Leaving rules and MCP tools untouched during a task preserves automatic prefix hits on `deepseek-v4.1-flash-1017` (`$0.007/1M`, 91.3% off fresh input) and `moonshotai/kimi-k3.1-pro` (`$0.198/1M`, 89.0% off fresh input).
- **Start a clean task when switching modes:** Switching between Architect, Code, and Debug changes the system prompt and resets the cached prefix. Finish planning in Architect mode, then kick off a fresh Code task for implementation.
- **Note on GLM `prompt_cache_key`:** Unlike DeepSeek V4.1 Flash and Kimi K3 (which cache prefixes implicitly with no key), `glm-5.3` and `glm-5.3-flash` rely on a stable `prompt_cache_key` field in the request body for cache affinity. Because Roo Code's standard OpenAI Compatible profile does not send custom body keys, `deepseek-v4.1-flash-1017` and `moonshotai/kimi-k3.1-pro` deliver the highest automatic cache-read savings in Roo Code out of the box.
- **Zero Data Retention (ZDR):** All five hosted models above include default [Zero Data Retention](/zero-data-retention/) for new teams and support `https://us.api.inference.net/v1`. Externally routed models (such as `deepseek-v4.1-flash`, `glm-5.2`, or `kimi-k2.6`) follow upstream provider retention terms.
- **Estimate session costs:** Model your turn count and cache hit ratio in the [Prompt Cache Calculator](/tools/prompt-cache-calculator/) or read [DeepSeek V4.1 vs Kimi K3 vs GLM-5.3 for Coding Agents](/guides/deepseek-vs-kimi-vs-glm-coding-agents/).

## Verify connectivity with cURL

If Roo Code reports a connection or authentication error, verify your key from a terminal:

```bash
export INFERENCE_API_KEY="inf_sk_..."
curl https://api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-1017",
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'
```

## Frequently asked questions

### How is Roo Code setup different from Cline or Kilo Code?

All three VS Code extensions use the **OpenAI Compatible** provider pointing at `https://api.inference.net/v1`. Roo Code adds per-mode provider profiles (Architect, Code, Debug, Ask) and full JSON profile import/export with custom pricing fields. See the dedicated guides for [Cline](/docs/integrations/cline/) and [Kilo Code](/docs/integrations/kilo-code/) if you run those extensions alongside Roo Code.

### Why does Roo Code show inaccurate cost estimates until I set custom pricing?

When using **OpenAI Compatible**, Roo Code defaults custom model prices to zero unless you populate `inputPrice`, `outputPrice`, and `cacheReadsPrice` (per 1M tokens) under **Model Configuration** or in your imported JSON profile.

### Can I use an Inference Pass plan key in Roo Code?

Yes. Paste your [Inference Pass plan key](/docs/api-keys/#plan-keys) into Roo Code's **API Key** field and pick any model included in your active plan.

### Why did Roo Code return a model-not-found error for Kimi K3?

Copy the exact catalog ID including its owner prefix: `moonshotai/kimi-k3` or `moonshotai/kimi-k3.1-pro`, never bare `kimi-k3`. Check `GET https://api.inference.net/v1/models` to verify live IDs.

Ready to start? [Create a free API key](/register/?model=deepseek-v4.1-flash-1017), browse the [model catalog](/models/), compare [Cline](/docs/integrations/cline/) and [Kilo Code](/docs/integrations/kilo-code/), or explore all guides in the [Integrations hub](/docs/integrations/).