Skip to main content

ai-agent-proxy

ai-agent-proxy is a small FastAPI service that accepts OpenAI-style requests, optionally relays them to a backend LLM, and writes inbox JSON for a local agent runtime to handle.

This package exposes one CLI:

  • ai-agent-proxy for the HTTP server

It is designed for a local workspace flow:

  • the API receives a request
  • the request JSON is written into the agent inbox
  • your local agent runtime handles it

Features

  • enqueue-only quick-release HTTP flow
  • optional backend LLM relay with backend reply capture
  • local inbox JSON output for agent runtimes
  • context_id extraction and compact follow-up inbox payloads
  • better OpenClaw responsiveness while long agent work is still running
  • batch-friendly message flow for ongoing conversations
  • pure local runtime design, so you can use the agent CLI you prefer

Yes / No

Yes:

  • this package is for the OpenClaw OpenAI-compatible backend API flow
  • it accepts OpenAI-style chat requests and turns them into local inbox work for the agent, which helps OpenClaw handle incoming messages more responsively
  • when new messages arrive while the agent is already working, the agent can learn about the later messages before replying to the original one, if time permits
  • it can forward requests to a backend LLM and still write the enriched request into the inbox
  • the agent is expected to use tools and skills to send the real reply outward

No:

  • this is not a general OpenAI endpoint replacement
  • this endpoint does not return the final assistant result in the HTTP response
  • it is not intended for clients that expect normal synchronous OpenAI chat completion behavior

Install

pip install ai-agent-proxy

After install, the main commands are:

ai-agent-proxy

Config

Proxy default config file: ./.ai-agent-proxy.conf

HOST=0.0.0.0
PORT=7011
KEY=aibot_<your-key-something>
WORKER=2
INBOX=~/.openclaw/workspace/inbox
URL=https://backend-llm.example.com/v1
API_KEY=sk_<your-backend-api-key>

API

This is an enqueue-only, quick-release API design intended to improve OpenClaw message handling throughput and give the agent room for batch processing.

  • POST /v1/chat/completions
  • GET /v1/models
  • GET /v1/models/{model_id}

For request endpoints, the server writes the request body into the local inbox and returns an immediate reply to release the HTTP connection.

How It Works

Important local workspace paths:

  • inbox: <workspace>/inbox

Inbox files are raw JSON only. There is no extra mailbox wrapper.

On chat requests:

  • if no backend LLM is configured, the proxy writes the request JSON into the inbox and returns an empty success response
  • if a backend LLM is configured, the proxy forwards the request, returns the backend response to the client, and also writes the request into the inbox
  • when a backend reply is available, the inbox JSON can include backend-llm-reply
  • when a context_id is found, repeated messages may be compacted for lighter inbox traffic

A separate local agent runtime can watch the inbox and handle the work.

Skills

Project skills live in ai_agent_proxy/skills/.

They describe:

  • the proxy workflow
  • outbound message delivery
  • context handling

Logs

Useful server log lines:

  • chat_completion request inbox file_size=... inbox_path=...
  • backend_forward_failed ...
  • invalid_json ...

Any agent-side logging depends on the runtime you choose.

Metadata

Release files for ai-agent-proxy 2.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-agent-proxy 2.3.3
File Size Uploaded
ai_agent_proxy-2.3.3.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-agent-proxy 2.3.3
File Interpreter ABI Platform
ai_agent_proxy-2.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / ai_agent_proxy-2.3.3.tar.gz

Download URL ai_agent_proxy-2.3.3.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
34a40847ed8681e3cf20da3392d13261bc1f44c9d5af33477245289a89a8a041
BLAKE2b-256 checksum
How to use checksums
9d2b15706f484488cd2f95c6d4412c436403c59df192f63e28d60bfbde57db94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / ai_agent_proxy-2.3.3-py3-none-any.whl

Download URL ai_agent_proxy-2.3.3-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cbe97daf3f62514f86d875261e36042fb08ae156d27923cbb14ac5a949d1a7c
BLAKE2b-256 checksum
How to use checksums
8a88d703be61fd09f5ca47bb349e59c5e0c61d675a106287902c29803d089f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

2.3.3 This release

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page