---
title: "Configure Claude Code and Claude Desktop"
description: "Choose the right auth variable, model mapping, and app-specific settings, then verify Claude requests."
version: "en"
---

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

# Configure Claude Code and Claude Desktop

Claude Code and Claude Desktop both use current-connection switching: their live
configuration points to one active connection. They share the Claude ecosystem,
but OcHub manages a different capability set for each.

| Capability | Claude Code | Claude Desktop |
| --- | --- | --- |
| Direct connection and official login | Yes | Yes |
| Model provider | Yes | Yes |
| MCP management | Yes | No |
| Skill distribution | Yes | No |
| Claude plugin integration | Yes | Not applicable |
| Session reading | Yes | Not a primary session source |

If you mainly code in a terminal, configure Claude Code first. Configure Claude
Desktop separately when its desktop client needs a third-party endpoint.
Connections are not copied between the two automatically.

## Configure a Claude Code direct connection

1. **Open Claude Code.** Select Claude Code under Apps and choose **Add
   connection**.

2. **Enter the endpoint.** Use the Anthropic-compatible Base URL supplied by
   the provider. Claude Code requests `/v1/messages` under it, so do not append
   the full Messages endpoint to a normal Base URL.

3. **Choose an auth variable.** Third-party services usually use
   `ANTHROPIC_AUTH_TOKEN` with Bearer auth. Official Anthropic keys usually use
   `ANTHROPIC_API_KEY` with `x-api-key`. Follow the provider's required header.

4. **Enter the key.** OcHub writes it only to the selected variable and removes
   the mutually exclusive alternative so one request does not carry both.

5. **Start with one model.** The default model is the fallback for roles that
   have no dedicated mapping.

6. **Review the preview.** Expand Files to be written. Confirm the destination
   `settings.json` and make sure native hooks, permissions, and statusline
   fields are preserved.

7. **Save and switch.** Save adds the connection to OcHub; Switch makes it the
   current Claude Code connection.

8. **Verify in a new terminal.** Quit an existing Claude Code session, make a
   short request, and inspect OcHub Usage or the provider dashboard.

> **Check the auth header before replacing the key**
>
> Putting a valid key in the wrong variable commonly produces a 401 or a missing
> Authorization / x-api-key message. Verify the Auth variable first.

## Configure role models

Claude Code can assign models to separate roles. OcHub writes the corresponding
`ANTHROPIC_DEFAULT_*_MODEL` fields.

| Role | Typical use | When empty |
| --- | --- | --- |
| sonnet | Everyday coding and general work | Uses the default model |
| opus | High-complexity reasoning | Uses the default model |
| haiku | Fast, lower-cost work | Uses the default model |
| fable | An additional role where supported | Uses the default model |

Each row can include a model ID, display name, and 1M-context toggle. The toggle
adds `[1M]` to the model ID; haiku does not support it. Enable it only when the
upstream explicitly supports that model and context window.

A safe sequence is:

1. Verify the default model with a real request.
2. Add the same known-good model for sonnet.
3. Add opus, haiku, or fable one at a time.
4. Test after each row so model and authentication errors do not overlap.

## Use official login

If Claude Code is already signed in, add an Official login connection. It writes
no third-party Base URL or key and keeps Claude Code's own account state.

Use it to:

- Move between a subscription account and a third-party API.
- Isolate an endpoint, key, or quota problem.
- Retain native Claude Code account features.

After switching back to official login, start a new Claude Code process. If it
still calls the old endpoint, scan **Advanced tools → Environment-variable
conflicts** for values that override `settings.json`.

## MCP, skills, and plugin integration

Claude Code supports OcHub-managed MCP and skills.

### MCP

1. Import existing Claude configuration under MCP servers, or add a server.
2. Enable Claude Code on the card.
3. Select **Sync to apps**.
4. Restart Claude Code and verify the server.

MCP is normally inferred next to the Claude config directory as
`~/.claude.json`. With a custom directory, review the actual inferred path
before syncing.

### Skills

Choose Claude Code during installation or enable it on an installed skill card.
Distribution relies on the skills CLI. If install or update fails, inspect its
version and `PATH` under **Advanced tools → CLI tool maintenance**.

### Claude plugin integration

**Claude plugin integration** in App settings allows skills and MCP features to
write Claude Code plugin-related configuration. Disable it only when you intend
to manage that configuration entirely by hand.

**Skip Claude onboarding** marks MCP onboarding complete. To see the official
flow again, use **Restore Claude onboarding** under Advanced tools.

## Configure Claude Desktop

Claude Desktop connections are managed separately:

1. Open the Claude Desktop app page.
2. Add a third-party connection with Base URL and key, or choose Official login.
3. Expand the preview and verify the Claude Desktop destination.
4. Save and switch.
5. Fully quit Claude Desktop, reopen it, and make a short request.

OcHub does not manage Claude Desktop MCP or skills. Use the client's native
settings for its extension configuration.

## Custom configuration directory

Claude Code defaults to `~/.claude`. Use App settings to choose another
directory for separate work and personal configurations, mounted storage, or a
test configuration.

After saving, restart OcHub and Claude Code and review the write path again. The
setting changes where configuration, MCP, and sessions are read; it does not
move old content automatically.

## Common problems

| Symptom | Check first | Fix |
| --- | --- | --- |
| 401 / unauthorized | Auth variable and key | Match Bearer versus x-api-key requirements |
| 404 | Base URL includes full `/v1/messages` | Return to the provider's base address |
| Model not found | Default and role mappings | Use a model ID from the provider |
| Old endpoint still used | Old terminal or environment variable | Restart and scan conflicts |
| MCP missing | Claude toggle, directory, JSON | Sync again and restart Claude Code |
| Risk of losing native settings | Preview and drift warning | Cancel, back up, and compare |

Before considering the setup complete, verify a real Claude Code conversation,
the correct model in usage or provider logs, a clean switch to official login,
and the expected MCP and skill targets.

Continue with [Manage connections](/guides/providers) for copy and drift behavior,
or [Manage MCP and skills](/guides/mcp-skills) for shared capabilities. For
configuration precedence, gateway compatibility, instruction loading, and MCP
scopes, see [Advanced Claude Code pitfalls](/claude/advanced).

Source: https://docs.ochub.org/claude/configure/index.mdx
