Skip to content
On this page
DEEPAA / DOCS

DeepAA Documentation

From one-line install, to connecting your agent in three steps, to understanding the cost of every call—all on your machine.

01

Install and start

One command installs and starts DeepAA; the local console opens at http://127.0.0.1:3210.

Install and start →
02

Connect an agent in three steps

Add a provider → connect the agent → quick launch. Configs are written automatically—no manual file edits.

Connect an agent in three steps →
03

Watch it happen

Keep coding as usual; the dashboard, session tracing, and token pricing fill in evidence and cost for every call.

Watch it happen →
A locally-run AI agent gateway & observability analytics tool

One command to see every model call, tool chain, and real cost.

What is DeepAA?

Unify access to model providers. Trace agent calls. Understand usage and costs.

DeepAA (Deep Agent Analytics) is an open-source (MIT), locally-run AI agent gateway and observability analytics tool. It manages your model providers, models, keys, and agent configurations on your own machine, traces every call between your agents and models, and ties usage, cost, and calculation basis to each request.

  • Free and open source (MIT) · model services billed by their providers
  • Local-first: observation and analytics data stays on your machine—never uploaded to any cloud
  • Zero-intrusion observation: no SDK, no code changes—point the agent at the local gateway and calls are recorded automatically
  • macOS & Windows (Linux not supported yet) · integrates Codex, Claude Code, OpenCode, DeepSeek Harness, and ZCode

What problems does it solve?

When you juggle multiple agents, models, and providers, three things hurt the most—DeepAA puts them all in one local workbench.

The pain you knowWhat DeepAA does
Scattered setup: every provider has its own balance and plan quota, checking them means opening each console; switching models means digging through agent config filesUnified provider & agent access: official presets and relay stations in one place, keys stored in the system credential store, agent configs synced automatically
Unclear usage and cost: how many tokens you burned today, what it cost, which agent spent the most—you can't really sayPer-request cost transparency: input/cache/output breakdown, unit prices, multipliers, and formulas, rollable up by model, provider, and agent
Black-box calls: how many model requests a task really made, which tools and context it carried—you never see itCall-chain tracing: drill down Session → Thread → Turn → Step with evidence for prompts, tool interactions, tokens, and latency

Six core capabilities

Unified provider & agent access

Manage model services, models, and keys from official and relay providers in one place; with config sync, one agent can use compatible models from multiple providers

Agent call-chain tracing

Follow tasks, sub-threads, turns, and steps; link prompts, model outputs, tool interactions, tokens, and latency together

Context & capability evidence

Inspect tools, MCP, Skills, and rule injections carried by requests; check context composition estimates, step-over-step changes, and compaction evidence

Per-request cost transparency

Break down input, cache read/write, and output costs with unit prices, multipliers, promotion rules, and the calculation basis

Provider status & rule updates

See balances and plan quotas; learn about new models and changes to prices, plans, promotions, and capability rules

Model-level failover

Configure ordered backup chains per model; switch automatically when conditions are met and no response content has been returned

All of this happens on your machine: observation and analytics data is stored locally and never uploaded to any DeepAA cloud.

How it works (30-second version)

DeepAA runs two local services: the web console at http://127.0.0.1:3210 for management and analytics, and a local gateway proxy at http://127.0.0.1:3211 for forwarding and capture.

01

The agent calls the local gateway

Once connected, agent model requests point at the gateway entry on 127.0.0.1:3211 (e.g. /codex/v1); models appear in the agent as "real-model-id_provider-route-id".

02

The gateway rewrites and forwards

The proxy rewrites the model field per target provider and injects the real key from the system credential store (agent config files only hold a placeholder token), then forwards to the official or relay upstream.

03

Capture, then derive analytics

Every forwarded call appends a raw capture under ~/.deepaa; background workers derive session hierarchy, a usage ledger, and aggregate views, updating the console pages.

Dual-channel observation

Beyond the gateway, agents running in their official direct mode (e.g. subscribed Codex / Claude Code) can be observed via zero-config local import: DeepAA reads only the session data the agent already saved on disk and feeds it into the same analytics pipeline; such records carry a "direct" source badge and keep official client benefits.

Network boundary

Apart from pulling the official pricing catalog and the provider balance/plan syncs you configure, observation and analytics data never leaves your machine.

One-line script install (recommended)

No manual Node.js setup needed: the script installs dependencies, picks a mirror based on your network, then starts the service and opens the console automatically.

curl -fsSL https://deepaa.dev/install.sh | bash

The script checks or installs Node.js, then starts DeepAA.

Or ask your local agent to install it

One-Prompt Install via Your Local AgentRecommended

Copy the prompt below and paste it into Claude Code, Codex, Cursor, or any local agent — it will install and launch DeepAA for you.

Install and start DeepAA (a local-first AI agent gateway, observability and analytics tool) on this machine:
1. Check the Node.js version — 22.13+ is required; if missing or outdated, install the LTS release first;
2. Run npm install -g deepaa for a global install; on a slow network, add --registry=https://registry.npmmirror.com to this install only; do not change global npm settings;
3. Once installed it auto-launches and opens http://localhost:3210 (proxy on port 3211); if the browser did not open, run deepaa to start it;
4. Verify the Web UI is reachable and report the URL back to me.

When finished, the console opens automatically (Web UI http://127.0.0.1:3210, proxy port 3211). The script performs the same steps as the manual install below—it just automates dependency and mirror setup.

Manual install on macOS

Works on both Apple Silicon and Intel Macs. Use it when the one-line script fails, or if you prefer to manage Node.js yourself.

1. Install Node.js 22.13+

brew install node@22

2. Install and start DeepAA

npm install -g deepaa

You can also download the installer from nodejs.org (China mirror: https://npmmirror.com/mirrors/node/). Run deepaa if the console does not open automatically. Default ports: Web UI `http://127.0.0.1:3210`, proxy `http://127.0.0.1:3211`; data directory `~/.deepaa`; a DeepAA shortcut appears in Applications automatically after install.

Manual install on Windows

Works on Windows 10/11 in PowerShell or Windows Terminal.

1. Install Node.js 22.13+ (download from nodejs.org — China mirror: https://npmmirror.com/mirrors/node/)

https://npmmirror.com/mirrors/node/

2. Install and start DeepAA

npm install -g deepaa

If PowerShell execution policy blocks global installs, run as administrator or use cmd. Run deepaa if the console does not open automatically; a DeepAA shortcut appears in the Start Menu automatically after install.

Run as a system service (optional: auto-start on boot + crash recovery)

For long-term use: starts automatically in the background after login, recovers from crashes, and the console is always ready.

deepaa service install

First launch: meet the console

After installation the browser opens http://127.0.0.1:3210 automatically (run deepaa if it didn't). No sign-up, no login—the console binds only to the loopback address, so only you can reach it.

The five pages in the top navigation

  • Dashboard — Default home: one-click agent launch, provider balances and plan quotas, request/token/amount overviews and trends
  • Session tracking — Session → Thread → Turn → Step call chains, event timeline, and the per-step evidence inspector
  • Interactive content — Reconstructs prompts, outputs, and tool results per step, with export
  • Token pricing — Per-request billing ledger: cost components, formulas, and reconciliation
  • Provider management — The configuration hub for providers, keys, models, and agent access

On first visit there is no provider yet: click "New provider" to start the three-step onboarding; after that the dashboard fills in balances, quotas, and usage stats.

Upgrade & Uninstall

Upgrades keep all local data (the ~/.deepaa data directory is independent of the app itself); uninstalling removes only the program, never your data.

Upgrade

Re-run the one-line install script (it detects the existing installation and updates it in place, Node runtime included), or update via npm:

curl -fsSL https://deepaa.dev/install.sh | bash
# Windows
irm https://deepaa.dev/install.ps1 | iex
# or (manual install)
npm install -g deepaa@latest

Uninstall

Run the commands below in order to remove the app; to delete all local data as well, manually remove the ~/.deepaa directory afterwards.

deepaa stop
deepaa service uninstall   # only if the system service was registered
deepaa icon uninstall      # remove the desktop shortcut
npm uninstall -g deepaa

Connect overview: three steps

From zero to observing takes three steps, all inside the guided wizard on the Provider management page; DeepAA writes the configs into your agents automatically—no manual file editing.

01

Install and start

One command installs and starts DeepAA; the local console opens at http://127.0.0.1:3210.

Install and start →
02

Connect an agent in three steps

Add a provider → connect the agent → quick launch. Configs are written automatically—no manual file edits.

Connect an agent in three steps →
03

Watch it happen

Keep coding as usual; the dashboard, session tracing, and token pricing fill in evidence and cost for every call.

Watch it happen →

Four concepts to know first

Gateway model ID

Models appear in the agent as "real-model-id_provider-route-id" (e.g. glm-5.3_zhipu.cn); picking one routes the request through the DeepAA gateway, which records it automatically.

Placeholder token

Agent configs receive a placeholder token (deepaa-gateway); real keys live only in macOS Keychain / Windows Credential Manager and are injected in memory at forwarding time.

Automatic config sync

Once a provider is enabled and the chain is complete, saving is syncing: managed config files of Codex, Claude Code, and other agents are written automatically.

CLI mode

Codex supports switching between "gateway mode" (full observation) and "official mode" (direct connection with official client benefits + local import).

Step 1: Add a provider

Open "Provider management" → "New provider" and choose an access type:

Official preset (recommended)

Search the dropdown for a provider or plan (DeepSeek, Zhipu GLM / GLM Coding Plan, Kimi For Coding, Volcano Ark, Qwen, MiniMax, OpenRouter, SiliconFlow, OpenAI subscription—18 official presets); fixed endpoints are auto-filled to prevent typos, so you can save directly.

The guided wizard after saving

  1. API key: real keys go only into the system credential store; the UI shows fingerprints and multipliers
  2. Model discovery & confirmation: presets are ready out of the box; relay providers can probe upstream models or pick from the pricing center and map the original provider for billing
  3. Connect agents & finish: tick the agents you use; default model, default key, and CLI config sync complete automatically, then the provider is enabled

Non-preset (relay / self-hosted gateway)

For relay stations built on Sub2API, New API, and custom upstreams: fill in at least one upstream URL—OpenAI protocol (chat/completions, responses) or Anthropic protocol (v1/messages); name and route ID are derived automatically.

Automatic balance & plan sync

Set the provider account under "Basics" and DeepAA syncs balances and price multipliers on a schedule; plan channels show 5-hour / weekly / monthly usage windows with remaining percentages. Skipping it doesn't affect gateway forwarding, but weakens cost accuracy—setting it is strongly recommended.

Step 2: Connect your agents

On the provider's "Agent access" tab (or the last wizard step), tick the agents—DeepAA writes the gateway entry and model catalog automatically:

The five integrated agents and their managed configs

Codex
~/.codex/config.toml (+ ~/.codex/deepaa/catalogs/)
Responses API only; gateway / official mode switch
Claude Code
~/.claude/settings.json
Managed env keys such as ANTHROPIC_BASE_URL
OpenCode
~/.config/opencode/opencode.jsonc
Responses / Chat / Messages gateway providers
DeepSeek Harness
~/.dsh/settings.yaml
Launches dsh web (port 3080) or the desktop app
ZCode
~/.zcode/v2/ dual-layer config
Hot-reloads in ~1 second—no restart needed

Managed files only ever contain the placeholder token—real keys never touch disk; the "Agent access" tab previews managed files and shows sync status with one-click fixes.

Step 3: Launch an agent and watch

Back on the dashboard, hit "Launch" on a connected agent card: pick the project directory, provider, model, and launch mode (terminal / dsh web / desktop app); you can also resume a past session or tweak reasoning effort and context settings.

DeepAA Codex launch dialog with provider, model, credential, launch mode, and project directory controls
Choose a provider, model, and credential to open your agent and sync local settings. Chinese product UI shown.View the full screenshot ↗

How do I know it worked?

  1. Pick a gateway model (the one with the "_route-id" suffix) in the agent's model selector and start a conversation
  2. Open "Session tracking": new sessions and steps usually appear on the timeline right away
  3. Open "Dashboard / Token pricing": request counts, tokens, and costs start growing

Official direct mode is observable too

Subscription channels (e.g. Codex official mode) pass credentials through the local CLI login—no system key stored; direct requests are observed via local import and carry a "direct" badge.

FAQ & Troubleshooting

Something not working after connecting? Check here first—most issues resolve in under a minute; otherwise report on GitHub Issues.

1. The browser didn't open the console after install?

Run deepaa to start and open it; if it still fails, run deepaa status to check both services.

2. Connected, but no call data shows up?

Check in order: ① the conversation used a gateway model (name with the "_route-id" suffix); ② agents opened before connecting need a restart to pick up the config; ③ open "Session tracking" to see whether new sessions appear; ④ official direct-mode data imports automatically within ~2 seconds.

3. Can't find gateway models in the agent?

Confirm under "Provider management → Keys & Models" that the model is added and available to that agent; the "Agent access" tab shows the exact reason (missing key, missing protocol upstream, …) with fix hints.

4. Provider balance or plan quota not showing?

Set the provider account under "Basics" (used to auto-sync balances and price multipliers), save, then click "Sync now".

5. Costs look different from expectations?

Check that the pricing center has the model's provider mapping and key multiplier filled in; relay amounts follow reconciliation adjustments; rows marked "estimated" are normal (estimated when the provider returns no usage).

6. Startup reports a port conflict?

The console defaults to 3210 and the proxy to 3211; free the port as prompted, or switch via the PORT / PROXY_PORT environment variables (see "Ports & Environment Variables").

7. Want the agent back on its native config?

Preview all managed config files and sync status under "Provider management → Agent access"; disable the provider or switch the CLI mode to stop routing through the gateway.

8. Where is my data stored, and is it uploaded?

Everything stays in the local ~/.deepaa directory and is never uploaded; see "Data Storage & Privacy" for cleanup policies and the never-delete list.

Page guide: Dashboard

The default home: agent launch area and provider status cards on top, six drag-sortable modules below.

What you'll see

  • Quick agent launch: one click per connected agent; provider cards show balance / plan quota (5h / weekly / monthly windows), "Sync now", and health badges
  • Scope overview: three KPI cards—requests / tokens / amount—each with Total / Volume / Plan views and trend lines (amounts are estimates: post-multiplier pay-as-you-go + plan cost estimate)
  • Token cost leaderboard: by model × provider (default), model, or provider; click a row to jump to the matching request details
  • Model / provider / agent analysis: three columns comparing token / spend / request metrics, plus model token trends
  • Spend trend & composition: pay-as-you-go and plan spend area charts with composition share
  • Intensity heatmap: hourly token intensity for the last 7 days—spot your peaks at a glance
DeepAA dashboard: request/token/amount overview, cost leaderboard, and hourly intensity heatmap
Dashboard: one-click agent launch, provider status, and full usage at a glance. Chinese product UI shown.View the full screenshot ↗

Page guide: Session tracking

A three-pane workbench: "Insights · session tree" on the left, "Events · timeline" in the middle, and the "Step N" inspector on the right.

Session → Thread → Turn → Step organizes tasks and sub-agents. Select a step to inspect inputs, outputs, tool arguments, tokens, latency, and raw messages on demand. Content previews and exports use explicit scopes; a limited preview does not represent the complete data.

What you'll see

  • Session tree grouped by agent, expanding Session → Thread → Turn, with fuzzy Session ID search
  • Timeline listing each step: target provider, model set, source badge (proxied / direct), time-to-first-byte, compaction and retry badges
  • Six inspector tabs: Overview (token usage & price-cost panels), Request, Response, Context, Interactive content, Capability list
  • The Context tab shows a composition bar: conversation / tool results / MCP tools / Skills / rules buckets, actual-vs-estimated tags, and step-over-step changes
  • Drill into full raw request bodies (loaded on demand); copy prompt template / tool summary / snapshot JSON
DeepAA session tracking: session tree, thread hierarchy, and the turn and step timelineDeepAA session tracking: session tree, thread hierarchy, and the turn and step timeline
Session tracking: locate a task on the left and follow model requests and tool steps on the timeline. Chinese product UI shown.View the full screenshot ↗View the full screenshot ↗

Page guide: Interactive content

Reconstructs every step's input and output as readable conversations: provider / Session / Thread / Turn / Step cascading filters, read step by step.

What you'll see

  • Per-step request rows with a "new in this step / full context" toggle; inheritance and dedupe auto-labeled (first step / inherited / newly added)
  • Bodies rendered by semantic class: system prompts, user input, agent-injected, tool results, model output, reasoning, and more
  • Multi-select filters for prompt category and model output to locate content fast; click to view image attachments
  • Full export: export the current scope as Markdown / JSONL; oversized requests confirm the budget first, then load individually
DeepAA interactive content page showing prompts, model outputs, and tool results per step
Interactive content: read inputs and outputs step by step, export by scope as Markdown / JSONL. Chinese product UI shown.View the full screenshot ↗

Page guide: Token pricing

The per-request billing ledger: every row is one model call, expandable to the full cost calculation.

Inspect token categories, matched rates, credential multipliers, settlement coefficients, and cost formulas per request, then compare totals by model, provider, and agent. Plans and subscriptions clearly label estimated and pending costs. Catalog sync notifies you of new models and versioned changes to prices, plans, and promotions. Reconciliation appends adjustments while preserving original historical amounts.

What you'll see

  • Summary cards: total requests / total tokens / total spend (estimate = post-multiplier pay-as-you-go + plan cost estimate) / average latency
  • Detail columns: provider, agent, billing channel, Session → Step dual IDs, model, peak/off-peak, price multiplier, plan credits, cost, latency
  • Each row expands into four cost layers: provider cost (original currency) → post-multiplier cost → estimated real cost (CNY, settlement rate frozen at booking) / plan cost estimate, with step-by-step formulas on hover
  • Reconciliation: hourly reconciliation for relay providers; adjustment rows are append-only and history is never restated; catalog version changes arrive as read-later notifications
  • A dozen filters: request outcome, billing channel, token composition, pending estimates, peak/off-peak, and more
DeepAA token pricing request details showing cost components, multipliers, tokens, and estimated plan costDeepAA token pricing request details showing cost components, multipliers, tokens, and estimated plan cost
Token pricing: each row shows one request, with charge components, multipliers, and cost estimates. Chinese product UI shown.View the full screenshot ↗View the full screenshot ↗

Page guide: Provider management

The configuration hub: provider list on the left (status, channels, balance summary) and the Basics / Keys & Models / Agent Access tabs on the right.

Check provider balances and plan quotas, choose models and credentials, then connect the agents you use. DeepAA syncs managed settings automatically so the same agent can use compatible models from multiple providers.

What you'll see

  • Basics: onboarding checklist, account sync (balances and price multipliers refresh on schedule), plan usage, settlement rate
  • Keys & models: key fingerprints and multipliers, preset catalog models, upstream model probing, manual adds from the pricing center, time-of-day / long-context price overrides
  • Agent access: default provider / model / key per agent, Codex CLI mode switch, managed-file previews and sync fixes
  • Model pricing center (global dialog under "Manage"): official presets auto-apply with notifications, LiteLLM import, manual overrides win
DeepAA provider management: provider list, plan quotas, and Basics, Keys & Models, and Agent Access tabsDeepAA provider management: provider list, plan quotas, and Basics, Keys & Models, and Agent Access tabs
Provider management: inspect balances and quotas, then configure Keys & Models and Agent Access. Chinese product UI shown.View the full screenshot ↗View the full screenshot ↗

Model-level failover

On the Keys & Models tab, give any model an ordered backup chain (cross-provider, up to 5): after 2 consecutive failed requests the chain takes over automatically in priority order; when context compaction is detected it switches back to the primary. Work sessions keep running and multi-model workflows stay in control.

DeepAA model failover table showing editable backup model-and-provider pairs in priority order
Set backup model-and-provider pairs and their priority for each model. Add, edit, or leave a chain empty. Chinese product UI shown.View the full screenshot ↗

Roadmap: Harness Intelligence

PLANNEDFollow releases and discussions on GitHub

CLI Command Overview

All commands available after installation:

# Smart start: starts whichever service is missing and opens the console when ready
deepaa

# Show runtime and service registration status
deepaa status

# Stop the Web UI and proxy (registered services keep their registration)
deepaa stop

# Register as a system service (optional): auto-start on login + crash recovery
deepaa service install

# Service management: status | start | stop | restart | uninstall
deepaa service status|start|stop|restart|uninstall

# Foreground run (development/debugging, Ctrl-C to stop)
deepaa open

# Start only the proxy (:3211) or the web UI (:3210)
deepaa proxy
deepaa web

# Show all commands
deepaa help

Ports & Environment Variables

Runtime configuration options. The console and proxy bind to the loopback address 127.0.0.1 by default.

VariableDefaultDescription
PORT3210Web UI and API server port
PROXY_PORT3211Local reverse proxy (gateway) port
HOST127.0.0.1Default bind address for Web UI and proxy
DEEPAA_DATA_DIR~/.deepaaShared directory for raw captures, blobs, SQLite, and local config
PORT=4000 PROXY_PORT=4001 node ./bin/deepaa.mjs

Data Storage & Privacy

DeepAA runs fully locally: observation and analytics data stays strictly on your machine and is never uploaded to any DeepAA cloud.

The ~/.deepaa data directory

  • captures/v2/**/*.jsonl — Raw JSONL capture files
  • blobs/<sha256>.body.gz — Large response body blob storage
  • deepaa.sqlite — Indexes and aggregated views
  • proxy-config.json — Local proxy configuration

Key safety

Real keys go only into macOS Keychain / Windows Credential Manager; agent config sync writes just a placeholder token, the proxy injects in memory, and raw captures never record the injected real credentials.

Storage management

Raw captures, body blobs, and derived artifacts can be cleaned by retention policy in the "Storage management" dialog; session hierarchy, the usage ledger, hourly stats, and other primary data are kept forever.

Network boundary

Only three kinds of outbound traffic: pulling the official pricing catalog (deepaa.dev), the provider balance / plan syncs you configure, and the model requests the gateway forwards.

Raw captures may contain sensitive information (API keys, prompts, responses). Do not share publicly or push to git.

Remote Model Pricing Catalog

The pricing catalog is published on this site and pulled automatically by clients:

https://deepaa.dev/data/defaults/llm_catalog.jsonl

It is JSONL: the first line holds catalog meta (schemaVersion / catalogRevision / publishedAt / FX rates / holiday calendars), followed by one provider object per line with model-level pricing. `#` and `//` comment lines and blank lines are skipped by consumers.

Agent access (MCP service)

The official docs are also published as a standard MCP (Model Context Protocol) service. Point an agent at the endpoint below and its model can list sections, read full section content, and search the docs—no API key required.

Endpoint

https://deepaa.dev/api/mcp

Codex client configuration (~/.codex/config.toml)

[mcp_servers.deepaa-docs]
url = "https://deepaa.dev/api/mcp"

Available tools

  • list_doc_sections — list all documentation sections with bilingual titles and anchor URLs
  • read_doc_section — read the full content of a section (Markdown, zh-CN / en-US)
  • search_docs — search section titles and full text by keyword

Faster Downloads in China

The one-click script probes your network and picks the faster channel automatically (npmmirror for users in mainland China)—no configuration needed. The mirror applies to that single install only and never rewrites your npm config.

1. Force a channel (cn = npmmirror / global = official)

curl -fsSL https://deepaa.dev/install.sh | DEEPAA_MIRROR=cn bash

2. Specify the npm mirror for a manual install

npm install -g deepaa --registry=https://registry.npmmirror.com

3. Node.js installer mirror (CN, for manual installs)

https://npmmirror.com/mirrors/node/

The one-click script falls back to the other channel on download failure; set DEEPAA_MIRROR=global to force the official source.

Build from Source

For development and contributions. Requires Node.js 22+ and pnpm.

1. Clone repository

git clone https://github.com/AIAgentAndy/DeepAA

2. Install dependencies

cd DeepAA
pnpm install

3. Build

pnpm build

4. Start

pnpm start

After building once, `pnpm start` launches production mode directly without rebuilding.