Using the API

IDEs and agents

VS Code's chat, OpenCode, and any other tool that speaks the OpenAI API, through Gatekeeper.

How-toFor developers

Every tool that accepts an OpenAI-compatible base URL works the same way: give it http://127.0.0.1:8787/v1 and your key. This page has the two the console provides a file for, and the pattern for everything else. The JSON is the console's; see Connect a client for the badge that says so.

VS Code

VS Code's chat takes custom models through its Custom Endpoint provider. Open the language-models file either way, then paste this block into it.

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac), start typing Chat: Open Language Models (JSON), and press Enter.
  2. In the agent chat, open the model selector, click +, then the go-to-file icon in the top right to open the file.
jsonfrom the console
[  {    "name": "Confidential Router",    "vendor": "customendpoint",    "apiKey": "${input:chat.lm.secret.-...}",    "models": [      {        "id": "<model-id>",        "name": "<model-id>",        "url": "http://127.0.0.1:8787/v1/chat/completions",        "toolCalling": true,        "vision": false      }    ]  }]

url is the full chat-completions address, not a base URL. After the block is in the file, click + in the model selector, open the gear on the Confidential Router group, choose Update API Key, paste the key, and press Enter. That writes the apiKey reference above; the id differs, so leave that line. Do not paste the key into the file. When the console knows the model, it also sets contextWindow to that model's context length and maxOutputTokens to at most 8192, so VS Code can derive an input budget that stays inside the window.

If the Custom Endpoint flow asks which API the endpoint speaks, choose Chat Completions. The router serves /v1/chat/completions, /v1/completions and /v1/embeddings; /v1/responses and /v1/messages answer 404 not_found, so the other two choices cannot work. Nothing outside this flow needs enabling: chat.agentHost.byokModels.enabled is for delegated agent-host sessions, not for the chat in the editor, and a model configured as above works without it.

One difference from the extensions on VS Code agent extensions: when a turn stalls and ends in a 502, VS Code's chat reports "Sorry, your request failed" with the status and stops there. It does not retry on its own, so the turn is lost rather than delayed; Try Again sends it afresh.

When the chat describes commands instead of running them

The assistant explains what it is about to do, writes the commands out in a code fence, and stops. Nothing is edited, nothing is run, no error appears anywhere, and every turn looks like it worked. The answer may also quote files or values it never read.

Read the value of toolCalling on the model. The line being there proves nothing. VS Code reads the property as a boolean, and false means what a missing property means: a model declaring that it cannot call tools. The request then goes out with no tools at all, and prose is the only answer left to it.

The property lives in chatLanguageModels.json, in VS Code's user folder:

SystemPath
macOS~/Library/Application Support/Code/User/chatLanguageModels.json
Linux~/.config/Code/User/chatLanguageModels.json
Windows%APPDATA%\Code\User\chatLanguageModels.json

A profile other than the default keeps its own copy under User/profiles/<profile id>/. One check needs no file at all: Ctrl+Shift+P, then Chat: Manage Language Models. A model that can call tools carries a Tools badge on its row. Read the word rather than the presence of a badge: a model with "toolCalling": false, "vision": true still shows Vision.

Set the value to true, save the file, and reopen that editor. The Tools badge on the row is the confirmation.

Then check the mode and the model. Only Agent mode edits files and runs commands. In Ask mode an answer in prose with the commands written out is correct behaviour rather than a fault, so a chat left in Ask produces the same shape as a model with no tools. The picker beside the mode selector has to be on this model rather than on Auto.

A false nobody remembers writing can arrive on its own. The deprecated chat.customOAIModels setting required a toolCalling field, typed by hand, and Copilot Chat migrates those entries into this file once, copying each model across as it stands: whatever value was in the old setting is the value in the new file.

A false does not always leave the model answering in prose. On VS Code 1.141.0 with Copilot Chat 0.69.0 the model is dropped from the picker in Agent and Ask alike, the selector falls back to Auto, and no request is sent at all. Where it stays selectable, the request goes out with no tools and you get the prose instead. The line to read is the same one either way.

OpenCode

OpenCode takes a provider block in opencode.json. Save it in your project, or in ~/.config/opencode/ for every project. @ai-sdk/openai-compatible is its adapter for any /v1/chat/completions server, which Gatekeeper is.

jsonfrom the console
{  "$schema": "https://opencode.ai/config.json",  "provider": {    "confidential-router": {      "npm": "@ai-sdk/openai-compatible",      "name": "Confidential Router",      "options": {        "baseURL": "http://127.0.0.1:8787/v1",        "apiKey": "sk-tee-v1-…"      },      "models": {        "<model-id>": {          "name": "<model-id>"        }      }    }  }}

"{env:ROUTER_KEY}" in place of the key reads it from the environment instead. Then pick the model in OpenCode. From a shell, with the model id prefixed by the provider name:

sh
opencode run "Explain what this repository does" -m confidential-router/<model-id>

Agent extensions inside VS Code

Cline, Roo Code and Continue run their own agent loop in VS Code rather than using VS Code's chat, and each takes the same base URL and key. Which of them completes a real editing task against production, the one trap that makes a correct 404 look like a broken catalogue, and what a long agent session costs in prompt tokens: VS Code agent extensions.

Tools that assign a model a role

Some tools do not use one route for everything. They give a model a role, such as chat, applying an edit, or completing at the cursor, and the roles do not share an endpoint: the generation ones go to /v1/chat/completions, while apply and autocomplete are prompted on the legacy /v1/completions. Continue is the one most people meet.

The router serves both routes for every model, so any role works; see POST /v1/completions for what the legacy route does. Nothing here needs a role left unassigned.

Completing at the cursor is worth one paragraph, because tools do it in two different ways and only one of them is a parameter. Continue, with provider: openai, does it in the prompt: the text before and after the cursor arrive inside a single prompt wrapped in the model's own fill-in-the-middle markers, <|fim_prefix|>…<|fim_suffix|>…<|fim_middle|> for a Qwen coder model. That is an ordinary completions request as far as this API is concerned, and it is served on any model. Other clients instead send the text after the cursor as a separate suffix parameter, and that one is only honoured where the model's backend serves the legacy route itself; where it is not, the request is refused with 400 unsupported_parameter naming suffix rather than answered with text written as if your file ended at the cursor.

Either way, what makes infilling good is the prompt reaching the model as written, with no chat template wrapped around it, and that happens only on a backend serving the legacy route natively. A model's capabilities list does not distinguish the two, so if cursor completion matters to you, ask the operator whether completions is declared on it.

Any other OpenAI-compatible tool

Three settings, whatever they are called in the tool:

  1. Base URL: http://127.0.0.1:8787/v1.
  2. API key: your sk-tee-v1- key.
  3. Model: an id from the console's Models screen.

A tool that insists on an https:// URL can be pointed at the router directly, https://api.router.superprotocol.com/v1, at the cost of the verification Gatekeeper does for you.

One class of tool cannot use a local address at all: the ones that send your base URL to their own backend and call it from there, so the address they resolve is theirs and not yours. Cursor is one, and it needs its own page: Connect Cursor. If a tool's requests arrive at Gatekeeper from an address that is not your machine, or never arrive at all while the tool reports success, this is why.

While an agent works, the Gatekeeper dashboard counts its requests per endpoint, and the console's Logs shows one metered row per generation: tokens and cost, never the prompt.