Why use the Room Proxy
- Let someone use Codex CLI or Claude Code through the room even if they do not already have their own OpenAI or Anthropic account set up for that CLI.
- Centralize provider access in MeshAgent instead of configuring raw provider credentials on each developer machine or CI job.
- Route Codex CLI, Claude Code, and similar tools through the same room-scoped endpoint pattern.
- Keep token usage reporting inside MeshAgent while the CLI continues to work like a normal OpenAI- or Anthropic-compatible client.
How it works
The Room Proxy exposes OpenAI- and Anthropic-compatible endpoints at room-scoped URLs:Setup: Shared first steps
These steps apply regardless of which CLI agent you are using.1. Authenticate to MeshAgent and create an API key
If you haven’t set up MeshAgent yet, start withmeshagent setup. Then create an API key. Copy the printed value — it is shown only once.
2. Create a token spec and generate a participant token JWT
The Room Proxy requires a participant token (JWT) as the bearer credential. The API key from Step 1 is used to sign it. The JWT is scoped to a specific room. Create a token spec file (contains no secrets — safe to commit):token-spec.yaml
my-room with your room name, then generate the JWT:
eyJ... JWT. Store it somewhere secure — you will use it as the API key value in your CLI agent’s configuration.
Token expiration: Tokens do not expire by default. Regenerate at any time by re-running this command with the same spec file.
3. What is the Meshagent-Session header?
The proxy requires a Meshagent-Session header on every request. For the Room Proxy, this value is the session identifier MeshAgent attaches to usage tracking for that proxied traffic.
For CLI tools, use a stable name for one run or terminal session such as codex-agent, codex-ci, or claude-local. This lets MeshAgent group token usage from that client session under the same session ID in reporting.
The header is consumed by MeshAgent and is not forwarded to OpenAI or Anthropic.
Codex CLI
Codex CLI supports custom model providers in~/.codex/config.toml, including custom base URLs, API key env vars, and static HTTP headers — making it a natural fit for the Room Proxy.
Install Codex
Store the JWT as an environment variable
Add the JWT from the shared setup to your shell environment:.env file that is sourced in your shell profile.
Configure ~/.codex/config.toml
Add a MeshAgent provider and profile:
~/.codex/config.toml
| Key | Description |
|---|---|
base_url | Replace my-room with your room name. |
env_key | The env var name holding the JWT from the shared setup. |
http_headers | Sets the session ID MeshAgent uses for usage attribution. |
model | Any model available through the OpenAI API. |
Run Codex with the MeshAgent profile
Claude Code
Claude Code is Anthropic’s CLI coding agent. It uses the Anthropic API and can be pointed at a custom base URL via environment variables.Install Claude Code
Configure environment variables
Set the following in your shell environment (or.env file):
Note: You may want to export the ANTHROPIC_MODEL you want to use as well for example claude-sonnet-4-6. You can also change the model when claude is running by running /model claude-sonnet-4-6.
Run Claude Code
If you have previously logged into Claude with another account be sure to runclaude /logout before connecting through MeshAgent.