> ## Documentation Index
> Fetch the complete documentation index at: https://docs.remyx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Model backends

> Anthropic (Claude), Z.ai (GLM), and Moonshot (Kimi) as first-class agent backends — plus the two-tier drafter/refiner pattern

Outrider's coding runtime speaks the Anthropic Messages protocol, so it can be pointed at any compatible endpoint. That makes the model backend a first-class choice per agent — the loop, guardrails, and refinement chain are identical on every backend; what changes is cost, latency, and the models on offer:

| Backend                | `provider` value       | Secret              | Base URL                            | Auth style                        | Default model     | Recommended `claude-timeout` |
| ---------------------- | ---------------------- | ------------------- | ----------------------------------- | --------------------------------- | ----------------- | ---------------------------- |
| **Anthropic (Claude)** | `anthropic` (or empty) | `ANTHROPIC_API_KEY` | api.anthropic.com                   | `x-api-key`                       | `claude-opus-4-8` | action default (`1500`)      |
| **Z.ai (GLM)**         | `zai`                  | `ZAI_API_KEY`       | `https://api.z.ai/api/anthropic`    | `Bearer` (`ANTHROPIC_AUTH_TOKEN`) | `glm-5.2`         | `3600`                       |
| **Moonshot (Kimi)**    | `moonshot`             | `MOONSHOT_API_KEY`  | `https://api.moonshot.ai/anthropic` | `Bearer` (`ANTHROPIC_AUTH_TOKEN`) | `kimi-k3`         | `3600`                       |
| **Custom / on-prem**   | `custom`               | your choice         | set `model-base-url`                | your choice                       | varies            | depends on backend           |

The higher timeout for Z.ai and Moonshot exists because their flagship models' thinking modes add per-turn latency; a GLM session routinely takes 15–20 minutes. The `provider` and `model` inputs are independent: `provider` names the endpoint, `model` picks the model from it (e.g. `glm-5.2` / `glm-4.6` on Z.ai; `kimi-k3` / `kimi-k2.7-code` on Moonshot; `claude-opus-4-8` / `claude-sonnet-4-6` / `claude-haiku-4-5` on Anthropic).

In the app, the backend is a radio in the [agent setup wizard](/platform/agents/overview#set-up-an-agent) and editable later under the agent's [Configuration](/platform/agents/overview#configuration). Connect each provider's key once under [Connectors](/platform/configure/connectors); Remyx pushes it to the repo as a secret at provisioning time.

***

## The `provider` input

In workflow YAML, one input wires the whole backend — auth env var, base URL, and mutual exclusion between the two auth styles:

```yaml theme={null}
- uses: remyxai/outrider@v1
  with:
    interest-id: ${{ vars.REMYX_INTEREST_ID }}
    provider: ${{ inputs.provider }}   # anthropic | zai | moonshot | custom
    model: ${{ inputs.model }}
    claude-timeout: 3600
  env:
    REMYX_API_KEY: ${{ secrets.REMYX_API_KEY }}
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }}
    MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }}
```

Pass every backend's secret in the step's `env:` block — the action reads only the one matching `provider`, so a single workflow can switch backends per dispatch. This input replaced the fork-side "Configure provider auth" case-switch step older workflows carried; an empty `provider` preserves the old behavior exactly, so existing installs need no migration. The action fails clean with a specific error if the selected provider's secret is missing (e.g. `provider=zai requires ZAI_API_KEY in the caller's env block`).

<Warning>
  Don't set both `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN` yourself: the runtime prefers `x-api-key`, which Bearer-auth backends reject with a 401. The `provider` input clears the non-selected variable for you — this is most of why it exists.
</Warning>

Use `model-base-url` directly (instead of `provider`) only for custom or on-prem endpoints — Bedrock, Vertex, or a proxy of your own.

***

## The two-tier drafter-refiner pattern

The recommended default for a repo you want worked continuously. It splits exploration and commitment into two workflows:

**Workflow 1: Drafter** — daily, budget tier, `publish: branch`

* Pushes draft branches only: no PRs, zero maintainer-facing noise. \~\$0.20–0.40/run.
* Each run accumulates repo intel — landing zones that worked, mechanism shapes that got rejected.

**Workflow 2: Refiner** — weekly, strong tier, `publish: pr`

* Picks the best drafter branch and generates a mechanism-level **gap analysis** against its source paper.
* Re-runs from that branch (`start-from-ref`) with the gap analysis as its brief (`lead-content`), through the full refinement chain, to a draft PR. \~\$5–10/week including the gap generation.

Why the split works: the drafter's branch anchors an extension point and test scaffolding, so the refiner commits to PR-shape on borderline cases; a budget tier makes daily exploration of the arXiv frontier (\~200 ML papers/day) rational; even failed branches contribute negative-space signal to the next pick.

Set it up from the wizard's **Advanced — models per phase → Two-tier** option (writes three workflows: the dispatch-capable main one, the drafter, the refiner), or from the CLI. Tier pairings are cross-provider and switchable — the app defaults to a GLM drafter with an Opus refiner:

```bash theme={null}
remyxai outrider setup-local --repo owner/name --auto-interest \
  --two-tier --drafter-model glm-5.2 --refiner-model claude-opus-4-8
```

Runs report their `tier` (main / drafter / refiner) in fleet telemetry, so [Reports → Costs](/platform/review/reports#costs) prices each tier separately.

***

## Cost telemetry

Every run reports `cost_usd`, `input_tokens`, and `output_tokens` as action outputs and into fleet telemetry. How the dollar figure is computed depends on the backend:

* **Anthropic**: the runtime's own `total_cost_usd` figure is authoritative.
* **Z.ai / Moonshot**: cost is computed from a per-model rate table keyed by the model actually used (`glm-5.2`, `glm-4.6`, `kimi-k3`, `kimi-k2.7-code`, `kimi-k2.7-code-highspeed`, …), overriding the CLI's Anthropic-rate estimate. An unknown model on a known host is priced at that host's flagship rate — expect a 3–4× error across tier pairs, so set `model` explicitly.
* **Custom endpoints**: the reported figure is an estimate.

The [Costs report](/platform/review/reports#costs) turns this into unit economics: runs per day by backend against **\$ per code artifact**.

***

## Choosing a backend

There's no house pick. Every backend runs the same loop behind the same guardrails; the practical variables are per-run cost, session latency, and the draft quality you observe on *your* repo:

* **Anthropic (Claude)** — Claude tiers over `x-api-key` auth; a full PR run with the refinement chain is roughly \$5–6.
* **Z.ai (GLM)** — GLM tiers at roughly 20× lower per-run cost; budget the longer timeout for thinking-mode latency.
* **Moonshot (Kimi)** — Kimi tiers, same Bearer-auth pattern and timeout guidance as Z.ai.
* **Custom / on-prem** — anything that speaks the Anthropic Messages protocol, via `model-base-url`.

The cheap way to decide is evidence, not defaults: per-dispatch routing (`remyxai outrider trigger --provider … --model …`) makes A/B-ing providers on the same paper nearly free, and [Reports → Costs](/platform/review/reports#costs) shows each backend's cost per code artifact against what its runs actually produced. The [two-tier pattern](#the-two-tier-drafter-refiner-pattern) sidesteps the choice entirely: explore on a budget tier daily, promote on the tier your merges say you trust.

***

## Related

<CardGroup cols={2}>
  <Card title="Actions" icon="gears" href="/platform/agents/outrider-action">
    All configuration inputs, guardrails, and run outcomes
  </Card>

  <Card title="Connectors" icon="link" href="/platform/configure/connectors">
    Connect Anthropic, Z.ai, and Moonshot keys
  </Card>

  <Card title="CLI: provider routing" icon="terminal" href="/cli#route-a-run-at-a-different-model-provider">
    Per-dispatch provider/model overrides
  </Card>

  <Card title="Backends guide (repo)" icon="github" href="https://github.com/remyxai/outrider/blob/main/docs/backends.md">
    The action's own backends reference
  </Card>
</CardGroup>
