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

> ## Agent Instructions
> Prefer the qBraid CLI for programmatic platform actions: pip install 'qbraid-cli>=0.12', then run `qbraid configure` once with an API key from https://account.qbraid.com/account/api-keys.
> When writing Python, prefer the qBraid SDK: `from qbraid.runtime import QbraidProvider` wraps devices, job submission (`device.run()`), and batch groups (`GroupJobSession`).
> Always install the latest packages (pip install -U qbraid qbraid-cli); do not pin versions from memory. qbraid-cli below 0.12.0 is incompatible with the current API.
> Device IDs use the QRN format vendor:provider:type:name (e.g. qbraid:qbraid:sim:qir-sv, rigetti:rigetti:qpu:cepheus-1-108q). Legacy underscore IDs are deprecated.
> The REST API base URL is https://api-v2.qbraid.com/api/v1, authenticated with an X-API-Key header.
> For endpoints without a dedicated wrapper, use `QbraidSessionV1` from `qbraid_core` — an authenticated session (`.get()`/`.post()`) that sets the X-API-Key header. Full spec: https://docs.qbraid.com/openapi-v2.json
> Free simulators cost no credits; QPU and GPU jobs consume credits. Surface the estimated cost to the user before submitting a paid job.
> For account signup, API keys, credits, and end-to-end action recipes, see https://qbraid.com/llms.txt.

# qbraid ai

> Use qBraid as your AI provider.

Point Claude Code or Codex at the qBraid AI proxy so requests run on your qBraid plan instead of a separate vendor subscription, and switch back whenever you want.

Quick start: qbraid ai connect claude

**Usage**:

```console
$ qbraid ai [OPTIONS] COMMAND [ARGS]...
```

**Options**:

- `--help`: Show this message and exit.

**Commands**:

- `connect`: Route an agent through the qBraid AI proxy.
- `disconnect`: Restore an agent's previous configuration.
- `status`: Show which agents are routed through qBraid.
- `models`: List models available on the qBraid proxy.
- `quota`: Show remaining qBraid AI quota.
- `token`: Print the qBraid credential for agents.

## qbraid ai connect

Route an agent through the qBraid AI proxy.

Writes to the agent's own config — Claude Code's settings.json, Codex's
config.toml — and records whatever it replaces so `qbraid ai disconnect`
can put it back.

The credential is not written into either config by default. Both agents
are pointed at a command that prints a token, so the key stays in your
qBraid config and a rotated token is picked up automatically.

Example:

```bash
qbraid ai connect claude
qbraid ai connect all --model claude-sonnet-4-6
```

**Usage**:

```console
$ qbraid ai connect [OPTIONS] [agent]
```

**Arguments**:

- `agent`: Agent to configure: claude, codex, or all [default: all]

**Options**:

- `-m, --model <str>`: Model id to pin (see `qbraid ai models`)
- `--refresh-interval <int>`: Seconds between credential refreshes (default: 300)
- `--api-url <str>`: Override the qBraid API base URL
- `--plaintext-key`: Write the API key into the config instead of using a token command
- `--help`: Show this message and exit.

## qbraid ai disconnect

Restore an agent's previous configuration.

Puts back exactly what was there before connecting — including removing
settings that weren't present to begin with.

Example:

```bash
qbraid ai disconnect claude
```

**Usage**:

```console
$ qbraid ai disconnect [OPTIONS] [agent]
```

**Arguments**:

- `agent`: Agent to restore: claude, codex, or all [default: all]

**Options**:

- `--help`: Show this message and exit.

## qbraid ai status

Show which agents are routed through qBraid.

Pass --check to confirm the credential is actually accepted — useful when
a session has started failing and you want to know whether it expired.

Example:

```bash
qbraid ai status --check
```

**Usage**:

```console
$ qbraid ai status [OPTIONS]
```

**Options**:

- `--check`: Also verify the credential against the proxy
- `--help`: Show this message and exit.

## qbraid ai models

List models available on the qBraid proxy.

The proxy matches model ids exactly, so pick one of these when setting
`--model` — an id the proxy doesn't know is rejected on the first request.

Example:

```bash
qbraid ai models
```

**Usage**:

```console
$ qbraid ai models [OPTIONS]
```

**Options**:

- `--help`: Show this message and exit.

## qbraid ai quota

Show remaining qBraid AI quota.

Example:

```bash
qbraid ai quota
```

**Usage**:

```console
$ qbraid ai quota [OPTIONS]
```

**Options**:

- `--help`: Show this message and exit.

## qbraid ai token

Print the qBraid credential for agents.

Hidden because it exists for Claude Code's `apiKeyHelper` and Codex's
`` command rather than for people. Prints the
credential and nothing else, so the agents can read it from stdout.

**Usage**:

```console
$ qbraid ai token [OPTIONS]
```

**Options**:

- `--help`: Show this message and exit.
