# Cloud model connections

> Save cloud model connections, choose which agents can use them, and restore each agent's previous settings.

Cloud model connections let compatible agents use Amazon Bedrock, Vertex AI,
or OpenRouter. Saving a connection grants access without activating it or
sending a request. Select the connection separately in each agent.

- App: **Accounts → Routing → Cloud model connections**
- CLI: `hansard account inference`

Provider API billing applies after selection. These connections never become
an automatic fallback when a subscription reaches its limit.

## Prepare a connection

| Provider       | Credentials and model                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------ |
| Amazon Bedrock | An authenticated AWS profile, region, and full model ID. Authenticate the profile through AWS first.         |
| Vertex AI      | A project, location, and full model ID, with Application Default Credentials or an external credential file. |
| OpenRouter     | An API key and full model ID. Hansard stores a private copy of the key.                                      |

Choose a model the provider makes available to the selected agent. Codex needs
Responses API support. Claude Code needs Anthropic API compatibility on
OpenRouter. Kimi Code also needs the model's published context window in tokens.
Setup does not verify credentials, model access, or a billed model request.

The supported combinations are:

| Provider       | Compatible agents                                                                                                                        |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Amazon Bedrock | Claude Code, Factory Droid, OpenCode, Cline CLI, Pi, Goose CLI, Aider, Crush, Zed                                                        |
| Vertex AI      | Claude Code, OpenCode, Antigravity CLI, Cline CLI, Pi, Goose CLI, Aider, Kimi Code, Qwen Code, Crush                                     |
| OpenRouter     | Claude Code, Codex, Grok Build, Factory Droid, OpenCode, Cline CLI, Pi, Goose CLI, Aider, Mistral Vibe, Kimi Code, Qwen Code, Crush, Zed |

## Select a connection in the app

1. Open **Accounts → Routing → Cloud model connections**.
2. Save the provider, credentials, and model settings.
3. Grant access to all compatible agents or select individual agents.
4. Turn off subscription routing for the agent that will use the connection.
5. Activate the connection for that agent.
6. Restart the agent.

Except for Claude Code, agents use a Bash or Zsh launcher on macOS or Linux.
Open a new terminal after setup. Hansard's managed launches supply the same
connection. Quit Zed before reopening it from a new terminal. An existing Zed
process keeps its environment.

Project, managed, and launch settings can take precedence. Claude.ai
subscription connectors are unavailable under Claude Code cloud authentication.
Native launches of a selected default profile refuse an active cloud connection.
Separate native profiles remain available.

## Manage connections from the CLI

This example saves a Bedrock connection and selects it for OpenCode:

```sh
hansard account inference save research --type bedrock --aws-profile research --region eu-west-1 --model <model-id> --clients all
hansard account inference list
hansard account inference use <connection-id> --client opencode
hansard account inference run opencode -- <agent-args>
```

`--clients` accepts comma-separated agent IDs or `all` compatible agents.
Omit it to save without granting access. For Vertex AI, provide `--project`
and `--region`, with `--credentials-file` when using an external credential
file. For OpenRouter, provide `--key-file` when creating or replacing the key.
Kimi Code also requires `--context-window`.

Run `hansard help account` for every field and supported agent ID.

## Turn off a connection

Select **Turn off** for the agent, or restore it from the CLI:

```sh
hansard account inference restore --client opencode
```

Restoration preserves unrelated preferences and refuses conflicting changes
to connection settings. Restart the agent after restoration. Other agents'
selections stay unchanged.

**Change access** grants access without activation. Turn off a selected agent
before removing its access. Restore every selection before editing credentials
or removing the connection.

Connection records and credentials stay on this device, outside archive sync.
AWS and Google credentials stay in their external stores. Reset and uninstall
also check and restore managed cloud settings before removing data.
