# Connect a coding agent to an LLM gateway

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> Point the coding agents on your labeled workstations at your LLM gateway, with the gateway key stored as a Secret.


Point the coding agents on your labeled workstations at your LLM gateway, with the gateway
key stored as a Secret. You want this when your team sends model requests through a gateway
such as OpenRouter. Then you don't set up each agent by hand. The steps work for any of
[the supported agents](https://docs-stg.ringleader.dev/workstations/coding-agents/supported-agents/) that an
LLM Integration configures. The examples use Claude Code, which is only an example.

## Prerequisites

- [Install Ringleader](https://docs-stg.ringleader.dev/install/), with the Ringleader application running.
- An account with an LLM gateway, and its key. The examples use OpenRouter.
- A namespace to work in. The examples use `acme`.
- A label that selects the workstations to connect. The examples use `team: platform`.
  [Selectors](https://docs-stg.ringleader.dev/reference/resources/selectors/) describes how labels select.
- A running workstation in that namespace. The examples use a workstation named
  `my-agent-box`; replace it with yours. To create one, follow the
  [Quickstart](https://docs-stg.ringleader.dev/quickstart/) and use your own name. Then run
  `rl workstation label my-agent-box team=platform -n acme`. Ringleader applies the
  configurations that select it on the workstation's next configuration pass.

## Store the gateway key as a Secret

Run `rl secret create` with the key. The Secret stays in your namespace, and Ringleader
masks its value wherever it shows it:

```bash
rl secret create openrouter -n acme --from-string token=<your-openrouter-key>
```

[Imperative creation commands](https://docs-stg.ringleader.dev/reference/cli/commands/imperative-creation/#rl-secret-create-name) lists every option of
the command.

## Add a coding agent to the workstations

A devtool in a WorkstationConfig installs a coding agent. The same label selects the
workstations that get it.

To install your agent, declare its devtool: `claude-code`, `codex`, `opencode` or `pi`. An LLM
Integration configures none of the other two agents, Cursor CLI and Antigravity CLI. This
example installs Claude Code. [Supported agents](https://docs-stg.ringleader.dev/workstations/coding-agents/supported-agents/)
says what each devtool gives you, and
[Coding agent setup](https://docs-stg.ringleader.dev/workstations/coding-agents/coding-agent-setup/)
says how to start each agent.

1. Save this file as `claude-code.yaml`. Change `team: platform` to your label, and `acme`
   to your namespace:

   ```yaml
   apiVersion: workstations.ringleader.dev/v1
   kind: WorkstationConfig
   metadata:
     name: claude-code
     namespace: acme
   spec:
     selector:
       matchLabels:
         team: platform
     devtools:
       - name: claude-code               # the example agent: use your agent's devtool
   ```

2. Run `rl apply -f claude-code.yaml`. Ringleader then installs Claude Code on every
   workstation labeled `team: platform`.

## Apply an Integration for the gateway

An Integration holds the gateway's address and a reference to the Secret.

1. Save this file as `llm.yaml`. Change `team: platform` to your label, and `acme` to your
   namespace:

   ```yaml
   apiVersion: workstations.ringleader.dev/v1
   kind: Integration
   metadata:
     name: llm
     namespace: acme
   spec:
     type: llm
     selector:
       matchLabels:
         team: platform
     llm:
       endpoint:
         source: external
         vendor: openrouter            # picks the URL and the protocol
         credentialRef:
           name: openrouter            # a Secret in this namespace
           key: token
   ```

2. Run `rl apply -f llm.yaml`. Ringleader then points the agents it configures on every
   workstation labeled `team: platform` at the gateway.

With `source: external`, Ringleader delivers the key to each of those workstations.
[Secrets on the workstation](https://docs-stg.ringleader.dev/security/credentials/secret-handling/#secrets-on-the-workstation)
says what that exposes. To keep the key off the workstations, follow
[Keep the gateway key off the workstation](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/#keep-the-gateway-key-off-the-workstation)
instead.

You write no base URL, no placeholder key and no agent settings, because `vendor` selects
them. The [Integration](https://docs-stg.ringleader.dev/reference/resources/integration/) reference lists every field
and every vendor.

An Integration does not configure every agent. Cursor CLI and Antigravity get nothing from it.
With `vendor: custom` it configures Claude Code only. Codex, pi and OpenCode depend on the
vendor and on `model`. [Supported agents](https://docs-stg.ringleader.dev/workstations/coding-agents/supported-agents/)
says what each agent gets. For an agent it does not configure, follow
[Run your own coding agent in Ringleader](https://docs-stg.ringleader.dev/guides/run-own-coding-agent/).

## Optional: Choose the model for other agents

Claude Code needs no model. Codex, pi and OpenCode use the model you name. To choose one, add
`model: anthropic/claude-sonnet-4.5` under `endpoint` in `llm.yaml`, which is an OpenRouter
model name. Use your gateway's own name for the model. Then run `rl apply -f llm.yaml` again.
[The pi and OpenCode providers](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/#the-pi-and-opencode-providers)
says when those two get a provider.

## Check what the Integration put on a workstation

Read the [generated configuration](https://docs-stg.ringleader.dev/workstations/configuration/integration-behavior/#generated-configuration)
that Ringleader built from the Integration, then the endpoint file on the workstation.

1. On your computer, run `rl integration get llm -n acme -o yaml`.
   `status.generatedConfig` names the configuration.
2. Run `rl workstationconfig get integration-llm -n acme -o yaml`. The output is the
   configuration.
3. Open a new shell on the workstation with `rl shell my-agent-box -n acme`. A shell that
   was already open keeps the environment it started with.
4. In that shell, run `cat /etc/ringleader/integrations/llm.json`. The file lists the names
   of the environment variables the Integration sets, such as `ANTHROPIC_BASE_URL`, and
   never their values.

[The endpoint files](https://docs-stg.ringleader.dev/reference/resources/integration/#the-endpoint-files) describes
what each file carries.

## Troubleshoot

- If a workstation has no endpoint file, check that its labels match the Integration's
  `matchLabels`, as [Integration reach](https://docs-stg.ringleader.dev/workstations/configuration/integration-behavior/#integration-reach)
  describes. If they match, check that its owner can read the Secret. The warning in
  [LLM gateways for coding agents](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/)
  says how to give access.
- If a variable still has its old value in a terminal, that shell is older than the
  Integration. Open a new shell.
- If `rl apply` refuses the Integration because of the model, your organization's policy
  limits which models you can name, as
  [Policy and OrgPolicy](https://docs-stg.ringleader.dev/reference/resources/policy/) describes. Choose a model the
  policy allows.

## Next steps

- [Run your own coding agent in Ringleader](https://docs-stg.ringleader.dev/guides/run-own-coding-agent/)
  connects an agent that an Integration does not configure, and keeps its key off the
  workstation.
- [LLM gateways for coding agents](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/)
  explains the vendors and models, how Ringleader keeps a gateway key, the pi and OpenCode
  providers, and how to override an Integration.
- [Keep the gateway key off the workstation](https://docs-stg.ringleader.dev/workstations/coding-agents/llm-gateways/#keep-the-gateway-key-off-the-workstation)
  stores the key with Ringleader instead of delivering it to the workstations.
- [Integration behavior](https://docs-stg.ringleader.dev/workstations/configuration/integration-behavior/) says which
  workstations an Integration reaches, and what happens when it stops applying.
- [Integration](https://docs-stg.ringleader.dev/reference/resources/integration/) lists the fields, the vendors and the
  endpoint files.

