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

# Use Codex and Claude with MeshAgent

> Configure Codex and Claude to use MeshAgent-managed routing.

MeshAgent can configure Codex CLI, Codex Desktop, and Claude Code to route through the hosted [MeshAgent LLM Proxy](./llm_proxy) automatically, giving you project-level routing, usage tracking, billing, and budget controls instead of sending model traffic directly to OpenAI or Anthropic. Claude Desktop support is coming soon.
By default, MeshAgent provides managed OpenAI and Anthropic access. To use your own provider credentials, configure them per project in [Integrations](../../project_admin/integrations).

MeshAgent supports two workflows:

* `meshagent setup`: Can be used to configure Codex or Claude to use MeshAgent by default, best when you want persistent local configuration changes.

* `meshagent launch codex` or `meshagent launch claude`: For when you want a one-off session through MeshAgent without changing your normal default configuration.

## `meshagent setup`

Start with:

```bash theme={null}
meshagent setup
```

`meshagent setup` is the guided, persistent setup flow. It can:

* Sign you in or reuse your existing session.
* Let you choose or create a project and activate it.
* Create and activate a project API key if needed.
* Check whether your account can use the LLM Proxy for that project.
* Offer to configure supported Codex or Claude installations found on your machine.

If your account does not have LLM Proxy access for the selected project, setup tells you and stops before trying to configure the local tool integrations.

### What `meshagent setup` changes for Codex

For Codex, setup can configure, update, or remove MeshAgent as the default provider in `~/.codex/config.toml`.

After setup:

* Run `codex` normally to use Codex through the active MeshAgent project.
* Rerun `meshagent setup` to update the MeshAgent Codex default or reset Codex back to OpenAI.

### What `meshagent setup` changes for Claude

For Claude, setup can create, update, or remove MeshAgent-managed settings in `~/.claude/settings.json`.

After that, run `claude` normally and it uses the configured MeshAgent project.

## `meshagent launch` commands

Use these commands for a one-off Codex or Claude session through MeshAgent. They work whether or not MeshAgent is configured as your default.

```bash theme={null}
meshagent launch codex
meshagent launch claude
```

These commands do not make MeshAgent your permanent default.

* `meshagent launch codex` launches `codex` with temporary Meshagent settings and environment for that process.
* `meshagent launch claude` launches `claude` with temporary MeshAgent settings and environment for that process.

Both commands use the active MeshAgent project by default. To target a different project for that launch, pass `--project-id` before any forwarded tool arguments.

### Forwarding tool arguments

`meshagent launch codex` and `meshagent launch claude` have their own MeshAgent options:

* `--project-id`
* `--api-url`

If you want to pass options through to Codex or Claude, put them after `--`.

For example:

```bash theme={null}
meshagent launch codex -- app
meshagent launch codex --project-id PROJECT_ID -- --search "how do agents work?"
```

For Codex, `app` is a forwarded Codex subcommand that can be used to launch the Codex Desktop app.

### Desktop apps

Codex Desktop is supported today through the same Codex configuration that `meshagent setup` manages.

To launch Codex Desktop through MeshAgent for a one-off session, use:

```bash theme={null}
meshagent launch codex -- app
```

If you want Codex Desktop to use MeshAgent automatically when you open it normally, make MeshAgent the Codex default during `meshagent setup`.

Claude Desktop automatic support is coming soon, so this page does not document a Claude Desktop launch command yet.

## Switch Back To Your Regular Provider Setup

If you only used `meshagent launch codex` or `meshagent launch claude`, there is nothing to undo. Those commands only affect that launch.

If you changed persistent local configuration:

* For Codex, rerun `meshagent setup` and choose the option to remove the MeshAgent Codex configuration. This resets Codex to OpenAI as the default provider.
* For Claude, rerun `meshagent setup` and choose the option to remove the MeshAgent Claude configuration.

If you install Codex or Claude after running setup, rerun `meshagent setup` so MeshAgent can detect and configure them.

## Related docs

* [MeshAgent LLM Proxy](./llm_proxy)
* [Local CLI Proxy](./local_cli_proxy)
* [Ask MeshAgent from the CLI](./ask_meshagent_cli)
* [MeshAgent CLI Commands](../../reference/meshagent_cli_help)
