
Show HN: AgentAPI – HTTP API for Claude Code, Goose, Aider, and Codex by hugodutka
Control Claude Code, Goose, Aider, and Codex with an HTTP API.
You can use AgentAPI:
- to build a unified chat interface for coding agents
- as a backend in an MCP server that lets one agent control another coding agent
- to create a tool that submits pull request reviews to an agent
- and much more!
-
Install
agentapi
by either:- Downloading the latest release binary from the releases page
- Or building from source:
go install github.com/coder/agentapi@latest
-
Verify the installation:
On macOS, if you’re prompted that the system was unable to verify the binary, go to
System Settings -> Privacy & Security
, click “Open Anyway”, and run the command again. -
Run a Claude Code server (assumes
claude
is installed on your system and in thePATH
):agentapi server -- claude
If you’re getting an error that
claude
is not in thePATH
but you can run it from your shell, trywhich claude
to get the full path and use that instead. -
Send a message to the agent:
curl -X POST localhost:3284/message -H "Content-Type: application/json" -d '{"content": "Hello, agent!", "type": "user"}'
-
Get the conversation history:
curl localhost:3284/messages
-
Try the demo web chat interface at https://coder.github.io/agentapi/chat. Even though it’s hosted on GitHub Pages, the chat will connect to your AgentAPI server running on
localhost:3284
.If you’re having trouble connecting to the demo chat on Safari, it’s likely because it’s blocking an HTTP-only connection to localhost. The demo may work in a different browser.
Run an HTTP server that lets you control an agent. If you’d like to start an agent with additional arguments, pass the full agent command after the --
flag.
agentapi server -- claude --allowedTools "Bash(git*) Edit Replace"
You may also use agentapi
to run the Aider and Goose agents:
agentapi server -- aider --model sonnet --api-key anthropic=sk-ant-apio3-XXX agentapi server -- goose
An OpenAPI schema is available in openapi.json.
By default, the server runs on port 3284. Additionally, the server exposes the same OpenAPI schema at http://localhost:3284/openapi.json and the available endpoints in a documentation UI at http://localhost:3284/docs.
There are 4 endpoints:
- GET
/messages
– returns a list of all messages in the conversation with the agent - POST
/message
– sends a message to the agent. When a 200 response is returned, AgentAPI has detected that the agent started processing the message - GET
/status
– returns the current status of the agent, either “stable” or “running” - GET
/events
– an SSE stream of events from the agent: message and status updates
Attach to a running agent’s terminal session.
agentapi attach --url localhost:3284
Press ctrl+c
to detach from the session.
AgentAPI runs an in-memory terminal emulator. It translates API calls into appropriate terminal keystrokes and parses the agent’s outputs into individual messages.
There are 2 types of messages:
- User messages: sent by the user to the agent
- Agent messages: sent by the agent to the user
To parse individual messages from the terminal output, we take the following steps:
- The initial terminal output, before any user messages are sent, is treated as the agent’s first message.
- When the user sends a message through the API, a snapshot of the terminal is taken befo
4 Comments
andrewfromx
can you compare this to https://github.com/eyaltoledano/claude-task-master ?
iddan
Was just looking for something like this in the past few days
jasonjmcghee
This is cool. I've been using claude code over SSH which also works very well. Even was using it via my home vpn on my phone while on a walk.
Seems like you could achieve the same type of experience with this.
StevenNunez
How did you get that org name!?