Skip to contentNewKimi K3.1 Pro is now availableTry it now
Docs / Roo Code

Roo Code

Connect Roo Code in VS Code to Inference.net with the OpenAI Compatible provider, exact live model IDs, custom context limits, pricing, and caching.

Last updated

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 and generate a project key in API keys. Enter these values in Roo Code's provider settings:

Roo Code settingValue
API ProviderOpenAI Compatible
Base URLhttps://api.inference.net/v1
US-only Base URL (optional)https://us.api.inference.net/v1
API KeyYour Inference.net API key (inf_sk_...)
Model IDdeepseek-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

  1. Open Roo Code provider settings

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

  2. Create an OpenAI Compatible profile

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

  3. 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). Paste your key from API keys into API Key.

  4. 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
  5. 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 page.

  6. 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).

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 IDContext / max outputFresh / Cached / Output ($/1M)Image inputModel page
deepseek-v4.1-flash-10171,040,000 / 393,216$0.08 / $0.007 / $0.635YesDeepSeek V4.1 Flash
glm-5.3-flash1,048,576 / 262,144$0.10 / $0.03 / $0.35YesGLM-5.3 Flash
glm-5.31,048,576 / 943,718$0.084 / $0.079 / $3.00NoGLM-5.3
moonshotai/kimi-k3.1-pro1,048,576 / 1,048,576$1.80 / $0.198 / $9.00YesKimi K3.1 Pro
moonshotai/kimi-k31,048,576 / 1,048,576$0.245 / $0.224 / $15.00YesKimi K3

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 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 or read DeepSeek V4.1 vs Kimi K3 vs GLM-5.3 for 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 and 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 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, browse the model catalog, compare Cline and Kilo Code, or explore all guides in the Integrations hub.