Agentapi Download

HTTP API for controlling coding agents like Claude Code, Goose, Aider via terminal emulator. Features REST endpoints, SSE events, web chat interface and MIT license.

⭐ 1,011 stars on GitHub
Latest Release: v0.11.4

About Software

AgentAPI provides an HTTP interface to control coding agents like Claude Code, AmazonQ, Opencode, Goose, Aider, Gemini, GitHub Copilot, Amp, Codex, Auggie and Cursor CLI. It runs an in-memory terminal emulator that translates API calls into terminal keystrokes and parses agent outputs into messages.

Server runs on port 3284 with endpoints for messages, sending messages, status checks and SSE event streams. Install with one curl command, then run like 'agentapi server -- claude'. Includes web chat interface at localhost:3284/chat. Configure allowed hosts and origins for CORS. Licensed under MIT.

Use Cases:

  • Control coding agents like Claude Code, Aider, Goose via HTTP API
  • Build unified chat interface for multiple coding assistants
  • Let one AI agent control another agent through MCP server
  • Submit pull request reviews to coding agents programmatically
  • Run agent server on port 3284 with REST endpoints and SSE events

Downloads

v0.11.4 December 09, 2025
agentapi-windows-amd64.exeexe
v0.11.3 December 09, 2025
agentapi-windows-amd64.exeexe
v0.11.2 November 24, 2025
agentapi-windows-amd64.exeexe
v0.11.1 November 22, 2025
agentapi-windows-amd64.exeexe
v0.11.0 November 07, 2025
agentapi-windows-amd64.exeexe
v0.10.2 November 01, 2025
agentapi-windows-amd64.exeexe
v0.10.1 October 16, 2025
agentapi-windows-amd64.exeexe
v0.10.0 October 06, 2025
agentapi-windows-amd64.exeexe
v0.9.0 October 03, 2025
agentapi-windows-amd64.exeexe

Package Info

Last Updated
Dec 09, 2025
Latest Version
v0.11.4
License
MIT
Total Versions
9

README

AgentAPI

Control Claude Code (https://github.com/anthropics/claude-code), AmazonQ (https://aws.amazon.com/developer/learning/q-developer-cli/), Opencode (https://opencode.ai/), Goose (https://github.com/block/goose), Aider (https://github.com/Aider-AI/aider), Gemini (https://github.com/google-gemini/gemini-cli), GitHub Copilot (https://github.com/github/copilot-cli), Sourcegraph Amp (https://ampcode.com/), Codex (https://github.com/openai/codex), Auggie (https://docs.augmentcode.com/cli/overview), and Cursor CLI (https://cursor.com/en/cli) with an HTTP API.

!agentapi-chat (https://github.com/user-attachments/assets/57032c9f-4146-4b66-b219-09e38ab7690d)

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!

Quickstart

  1. Install agentapi:

    OS=$(uname -s | tr "[:upper:]" "[:lower:]");
    ARCH=$(uname -m | sed "s/x86_64/amd64/;s/aarch64/arm64/");
    curl -fsSL "https://github.com/coder/agentapi/releases/latest/download/agentapi-${OS}-${ARCH}" -o agentapi && chmod +x agentapi
    

    Alternatively, you can download the latest release binary from the releases page (https://github.com/coder/agentapi/releases).

  2. Verify the installation:

    agentapi --help
    

    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.

  3. Run a Claude Code server (assumes claude is installed on your system and in the PATH):

    agentapi server -- claude
    

    If you're getting an error that claude is not in the PATH but you can run it from your shell, try which claude to get the full path and use that instead.

  4. Send a message to the agent:

    curl -X POST localhost:3284/message \
      -H "Content-Type: application/json" \
      -d '{"content": "Hello, agent!", "type": "user"}'
    
  5. Get the conversation history:

    curl localhost:3284/messages
    
  6. Try the chat web interface at http://localhost:3284/chat.

CLI Commands

agentapi server

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

[!NOTE] When using Claude, Codex, Opencode, Copilot, Gemini, Amp or CursorCLI, always specify the agent type explicitly (eg: agentapi server --type=codex -- codex), or message formatting may break.

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

Allowed hosts

By default, the server only allows requests with the host header set to localhost. If you'd like to host AgentAPI elsewhere, you can change this by using the AGENTAPI_ALLOWED_HOSTS environment variable or the --allowed-hosts flag. Hosts must be hostnames only (no ports); the server ignores the port portion of incoming requests when authorizing.

To allow requests from any host, use * as the allowed host.

agentapi server --allowed-hosts '*' -- claude

To allow a specific host, use:

agentapi server --allowed-hosts 'example.com' -- claude

To specify multiple hosts, use a comma-separated list when using the --allowed-hosts flag, or a space-separated list when using the AGENTAPI_ALLOWED_HOSTS environment variable.

agentapi server --allowed-hosts 'example.com,example.org' -- claude
# or
AGENTAPI_ALLOWED_HOSTS='example.com example.org' agentapi server -- claude

Allowed origins

By default, the server allows CORS requests from http://localhost:3284, http://localhost:3000, and http://localhost:3001. If you'd like to change which origins can make cross-origin requests to AgentAPI, you can change this by using the AGENTAPI_ALLOWED_ORIGINS environment variable or the --allowed-origins flag.

To allow requests from any origin, use * as the allowed origin:

agentapi server --allowed-origins '*' -- claude

To allow a specific origin, use:

agentapi server --allowed-origins 'https://example.com' -- claude

To specify multiple origins, use a comma-separated list when using the --allowed-origins flag, or a space-separated list when using the AGENTAPI_ALLOWED_ORIGINS environment variable. Origins must include the protocol (http:// or https://) and support wildcards (e.g., https://*.example.com):

agentapi server --allowed-origins 'https://example.com,http://localhost:3000' -- claude
# or
AGENTAPI_ALLOWED_ORIGINS='https://example.com http://localhost:3000' agentapi server -- claude

agentapi attach

Attach to a running agent's terminal session.

agentapi attach --url localhost:3284

Press ctrl+c to detach from the session.

How it works

AgentAPI runs an in-memory terminal emulator. It translates API calls into appropriate terminal keystrokes and parses the agent's outputs into individual messages.

Splitting terminal output into 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:

  1. The initial terminal output, before any user messages are sent, is treated as the agent's first message.
  2. When the user sends a message through the API, a snapshot of the terminal is taken before any keystrokes are sent.
  3. The user message is then submitted to the agent. From this point on, any time the terminal output changes, a new snapshot is taken. It's diffed against the initial snapshot, and any new text that appears below the initial content is treated as the agent's next message.
  4. If the terminal output changes again before a new user message is sent, the agent message is updated.

This lets us split the terminal output into a sequence of messages.

Removing TUI elements from agent messages

Each agent message contains some extra bits that aren't useful to the end user:

  • The user's input at the beginning of the message. Coding agents often echo the input back to the user to make it visible in the terminal.
  • An input box at the end of the message. This is where the user usually types their input.

AgentAPI automatically removes these.

  • For user input, we strip the lines that contain the text from the user's last message.
  • For the input box, we look for lines at the end of the message that contain common TUI elements, like > or ------.

What will happen when Claude Code, Goose, Aider, or Codex update their TUI?

Splitting the terminal output into a sequence of messages should still work, since it doesn't depend on the TUI structure. The logic for removing extra bits may need to be updated to account for new elements. AgentAPI will still be usable, but some extra TUI elements may become visible in the agent messages.

Related Software

Rpcs3 Android

PlayStation 3 emulator for Android 12+. Project discontinued at Alpha-7 and merged with RPCSX. Use RPCSX Android UI for continued development.

⭐ 1,186

Wx Channel

WeChat video channel downloader (微信视频号下载助手) built with Go and SunnyNet featuring one-click download, batch processing, automatic decryption, smart deduplication, web console at dongzuren.com/wx_channel with browse history/download records/queue management, CSV export, configurable cleanup, and responsive design with MIT license.

⭐ 1,170

Myclaude

Claude Code and Codex multi-agent development system with 6-step dev workflow, 90% test coverage requirement, BMAD agile workflow, modular Python installation and MIT license.

⭐ 1,163

Clippy

Local LLM chatbot featuring 1990s Microsoft Office Clippy UI, running GGUF models via Llama.cpp/node-llama-cpp with one-click installation for Gemma3/Llama 3.2/Phi-4/Qwen3, automatic hardware acceleration (Metal/CUDA/Vulkan), custom model/prompt support, offline operation, and @electron/llm reference implementation with NOASSERTION license.

⭐ 1,132ai, clippy, electron

Rclone Ui

Cross-platform Tauri desktop GUI for rclone & S3 controlling remote instances via RCD daemon on port 5572, featuring Docker/homelab support with NextUI/HeroUI interface, multi-platform package managers (Flathub, Brew, Scoop, Chocolatey, WinGet, NPM), and downloads for Windows/macOS/Linux with Apache 2.0 license.

⭐ 1,127nextui, rclone, rclone-gui

Pastemax

Desktop file viewer built with Electron/React/TypeScript for developers to navigate, search, and copy code from repositories for pasting into LLMs, featuring token counting, model context limits (Claude/GPT-4o/Gemini), file tree navigation, search/sort, binary exclusion, workspace management, and cross-platform support with MIT license.

⭐ 1,124