Skip to main content

WebSocket relay that bridges AI coding agent CLIs (Claude Code, Codex, Gemini CLI, Snowflake Cortex) to any web interface — stream reasoning, tool calls, and file changes in real time.

Project description

ai-relay

WebSocket relay that bridges AI coding agent CLIs (Claude Code, Codex, Gemini CLI, Snowflake Cortex, and more) to any web interface — stream reasoning, tool calls, and file changes in real time.

Install

pip install ai-relay

Quick start

# Start the relay server (default: ws://0.0.0.0:8765)
ai-relay --port 8765

Then connect from OhWise Lab (or any WebSocket client) and send a handshake:

{"tool": "claude", "folder": "/path/to/project", "model": "claude-sonnet-4-6"}

The relay spawns the CLI process, streams all output as structured JSON events over WebSocket, and forwards your messages as stdin to the process.

Event types

Type Description
session_start Process spawned
session_end Process exited (includes exit_code)
stdout / stderr Raw output lines
reasoning Agent thinking/planning text
tool_call Agent invoking a tool (Read, Edit, Bash…)
tool_result Result of a tool call
file_diff File created or edited
response Final answer text
quota_warning API quota / rate limit detected
context_warning Context window nearing limit (includes context_pct)
context_compacted Context was compacted
error Relay or process error
input_ack Relay confirms your message was sent to the process

Sending commands

Send JSON over WebSocket:

{"text": "refactor the authentication module to use JWT"}

To send CLI commands (e.g. /compact, /clear):

{"text": "/compact"}

Supported tools

Tool Adapter tool value
Claude Code ClaudeCodeAdapter "claude" / "claude-code"
OpenAI Codex GenericAdapter "codex"
Gemini CLI GenericAdapter "gemini"
Snowflake Cortex GenericAdapter "cortex"
Any CLI GenericAdapter "generic"

Python API

from ai_relay import RelayServer

server = RelayServer(host="0.0.0.0", port=8765)
server.run()

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_relay-0.2.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_relay-0.2.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_relay-0.2.0.tar.gz.

File metadata

  • Download URL: ai_relay-0.2.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ai_relay-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d85f0844185cb93e8834e5f6784abf0724e08ccc16c7232ebe55f951ed85403
MD5 17a060e8e0a488796ca9ff455b3a607d
BLAKE2b-256 4c877251bf9ee47053eb7c7cd4d0afd082a927575747efeb3930b2a641c606a0

See more details on using hashes here.

File details

Details for the file ai_relay-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ai_relay-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ai_relay-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4ddc75681f1dc16e1a92efcc0d5d5fa521edea2e3249cae2c8e868030958845
MD5 e02b923749b0d4ca558b8aa90fec4d10
BLAKE2b-256 5b85514557fd69581efd3f9d4f4c871d05c53e431c0b14d6be7e82611b14d64e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page