Skip to content

Claude Code

How midcode runs Claude Code, which accounts work in the chat, the optional API key, and the Terminal view for a Claude plan.

View as Markdown

Claude Code runs in midcode’s Agent panel in both views. The Chat view talks to Claude Code’s engine through an adapter and records every edit. The Terminal view is the claude command itself. Which one you use depends on how you pay for Claude: the chat needs an API account, and a Claude plan runs in the Terminal view.

What the panel does for every agent (the prompt, the crosshair, permission cards, undo) is in Your agent in midcode.

At a glance

WhatChatTerminal
midcode startsnpx -y @agentclientprotocol/claude-agent-acp@0.84.0 --hide-claude-authclaude, typed into a login shell
Needs on your MacNode.js (for npx)Claude Code: npm install -g @anthropic-ai/claude-code
AccountAn Anthropic Console account, or an API keyWhatever Claude Code is signed in with, a Claude plan included
Claude’s editsEach one is a ⌘Z step and a line in PublishOn the canvas and in Publish; undone with Claude Code or git

The chat

The first time you open the chat, npx downloads the adapter, and the panel says “Getting Claude Code ready” for about a minute. The adapter’s version is fixed by each midcode release, so it changes when midcode updates, not on its own.

The pickers under the prompt (mode, model, effort) are the options Claude Code’s engine offers for the session with your account. midcode adds none, and remembers the model and effort you chose.

Which accounts work

  • Claude Code’s own sign-in, when it’s an Anthropic Console account or an API key. Nothing to set up: the chat uses the sign-in Claude Code already has on your Mac, and usage is billed to that account. If you haven’t signed in yet, run claude in a terminal and /login once.

  • An API key saved in midcode. With one, the chat needs nothing but Node.js.

A Claude subscription plan (Pro or Max) does not work in the chat. midcode starts the adapter with --hide-claude-auth, which keeps it from using a claude.ai subscription sign-in: Anthropic doesn’t allow apps other than its own to bill a Claude plan. If your Claude Code is signed in with a plan, the chat says so:

Text
Your Claude Code is signed in with a Claude plan, which apps like midcode can't use. Add an API key, or use the Terminal view.

The API key

The key is optional. To add one:

  1. With Claude Code chosen in the chat, click “API key” (the key icon in the panel’s header).

  2. Paste the key. “Get a key” opens the Anthropic Console’s keys page.

  3. Click “Save key”.

Before saving, midcode asks Anthropic’s API whether it accepts the key, and tells you if it doesn’t. A saved key wins over Claude Code’s own sign-in: the chat bills that key’s account. The key is kept encrypted on your Mac, outside your project, and is handed only to the agent’s process when it starts (as ANTHROPIC_API_KEY). More in Privacy and security.

“Remove the saved key”, in the same place, deletes it. Saving or removing a key stops the running agent and starts a new chat.

The Terminal view

Switch the panel to the Terminal view (“Show as a terminal”) and midcode opens a login shell in your project’s folder and types claude. It’s Claude Code exactly as in your own terminal: the same sign-in (a Claude plan works here), the same settings, your CLAUDE.md, your commands. The two buttons in the header paste the selected element’s reference, or your open comments, into its prompt.

In this view Claude Code writes files by itself: they show on the canvas and in Publish’s list of changed files, but they are not steps in midcode’s ⌘Z.

Limits

  • The chat doesn’t read an ANTHROPIC_API_KEY that your shell exports: variables like that are left out when midcode starts the agent. Save the key in midcode instead. The Terminal view is your shell, so there it applies.

  • What the chat picks up from your Claude Code setup (settings, hooks, MCP servers) is up to the adapter. If something you rely on is missing, use the Terminal view.

Troubleshooting

“Claude Code needs Node.js”. The chat is started with npx. Install Node.js, then press “Check again”.

“Claude Code isn’t signed in with an API key or a Console account.” Run claude and /login once in a terminal, or add an API key.

The key isn’t accepted. It has to start with sk-ant- and be active in the Console.

To have Claude write code that stays editable on the canvas, install the midcode skill or point it at Code that midcode can edit.