# Using Claude Code with Sellpath

This guide explains how to connect native Claude Code clients to a Sellpath
LLMGW Claude Code connection.

## Before you start

An administrator must create a Claude Code connection for your project and
give you:

- the exact environment-specific gateway URL, ending in `/claude-llm`
- the virtual gateway key
- the configured authentication scheme: `Bearer` or `x-api-key`

Use the URL and scheme from the Admin UI setup artifact. Do not append `/v1`
or substitute another environment hostname.

## Claude Code CLI

For a `Bearer` connection:

```bash
export ANTHROPIC_BASE_URL="https://<environment-gateway>/claude-llm"
export ANTHROPIC_AUTH_TOKEN="<llmgw-virtual-key>"
claude
```

For an `x-api-key` connection, use `ANTHROPIC_API_KEY` instead:

```bash
export ANTHROPIC_BASE_URL="https://<environment-gateway>/claude-llm"
export ANTHROPIC_API_KEY="<llmgw-virtual-key>"
claude
```

The gateway key is a Sellpath credential. It is not an Anthropic API key and
must not be used as `CLAUDE_CODE_OAUTH_TOKEN`.

## Claude Desktop, VS Code, and Agent SDK

Use the corresponding setup artifact from the Admin UI. It supplies the same
base URL and key through the client-specific configuration mechanism. Keep the
key in the operating system or client secret store and do not commit it to a
repository.

The Agent SDK must preserve the parent process environment when launching
Claude Code. Merge the gateway variables into `process.env` rather than
replacing the complete environment.

## Key rotation and revocation

An administrator can rotate the connection key or disable the connection. A
rotated key is shown only once; update every client that uses it. A disabled
connection rejects new requests.

## Private subscription runtime

The separate **Claude subscription** Admin UI page is experimental and uses
`/claude-agent`, a Sellpath agent API backed by a private Claude Code runtime.
It is not a native Claude Code base URL and does not distribute Claude OAuth
tokens or `.credentials.json` files. Use it only with an approved Sellpath
agent client.

Gateway mode runs through LLMGW. It does not make Claude.ai web, Desktop cloud,
Remote Control, or other Anthropic cloud sessions available through the
gateway.
