Open protocol for testing network-isolated AI systems
Project description
spectral-bridge
Connect your private AI system to external testing and evaluation platforms — safely, and without any network changes. Use it for red-teaming, capability evaluations, safety benchmarks, and any other workflow where an outside platform needs to send prompts to a model it can't reach directly.
spectral-bridge is a relay client that makes AI systems reachable to outside platforms over a single outbound connection, without exposing them to the internet or requiring firewall and VPN changes. Built on an open protocol any platform can adopt.
Who this is for
AI teams running models on private infrastructure. If your AI system runs somewhere that isn't reachable from the public internet — inside a corporate VPN, on an air-gapped research cluster, on a private cloud subnet, or on a developer's laptop — you've probably hit a wall when trying to use external testing or evaluation platforms. They expect a public URL. You don't have one, and getting one means weeks of security review, firewall exceptions, or sharing VPN credentials with a third party.
Testing and evaluation platforms. If you run a platform that needs to send requests to customer-hosted AI systems, you've seen the same wall from the other side. Every new customer is a custom integration: their network, their security team, their constraints. spectral-bridge gives you a single protocol to support instead.
What it solves
The core problem is asymmetric: testing platforms need to initiate requests, but private AI systems can't receive them from the outside. The usual fixes all have real costs:
- Opening inbound firewall rules requires a security review and creates a permanent attack surface.
- Granting VPN access to a third party means sharing credentials to your whole network, not just the AI system.
- Deploying a public proxy means standing up and securing new infrastructure for every platform you want to use.
- Skipping external evaluation entirely means flying blind on safety, capability, and regression testing.
spectral-bridge replaces all of these with a single outbound WebSocket connection from inside your network to the testing platform's relay. Nothing inbound. No VPN sharing. No new public infrastructure. The only thing that crosses the boundary is the AI system's text response to a test prompt — nothing else on your network is reachable.
How it works
spectral-bridge defines an open protocol that testing platforms can adopt to let you safely connect your AI system to their infrastructure. A client runs inside your network and opens a single outbound WebSocket connection to a relay server. Requests flow from the relay to the client; responses flow back the same way. No inbound ports, no firewall changes, no VPN sharing.
Client. This repo provides a ready-to-use implementation, released under Apache License 2.0. It's written in Python, released on PyPI, and works out of the box with all compliant servers.
Server. The relay server is the testing platform's responsibility.
Security boundary. The relay does not give the testing platform access to your network. Traffic terminates at the adapter — a small process you control that exposes only a single OpenAI-compatible endpoint. Nothing else is forwarded.
Quickstart
Install
pip install spectral-bridge
# Include the built-in pass-through adapter:
pip install "spectral-bridge[pass-through]"
Connect
Your testing platform will provide a relay URL and an API key. Set the key as an environment variable (this keeps it out of shell history):
export SPECTRAL_BRIDGE_API_KEY=<your-api-key>
If your AI system already exposes an OpenAI-compatible HTTP endpoint, the built-in pass-through adapter is all you need. Point --target at your internal AI system's URL:
spectral-bridge start \
--relay-url wss://relay.example.com/connect \
--adapter pass-through \
--target http://internal-host:8080
This starts the adapter locally, connects to the relay, and begins forwarding requests.
Adapters
An adapter is a thin translation layer that sits between spectral-bridge and your AI system. It serves a single endpoint — POST /v1/chat/completions — using standard OpenAI-compatible request and response shapes.
Adapters can be written in any language. Any process, container, or script that serves that endpoint qualifies.
The built-in pass-through adapter proxies to an existing OpenAI-compatible endpoint and covers most cases. If your AI system has a different shape, writing a custom adapter takes minimal effort — one HTTP endpoint, one JSON schema. See the adapter documentation for details.
Protocol
spectral-bridge is built on an open protocol so that any testing platform can integrate relay support. The protocol has three parts:
-
Adapter contract — any process serving
POST /v1/chat/completionsqualifies. Only the chatbot's text response crosses the network boundary; no raw traffic from the internal host is forwarded. -
Relay client — connects outbound to
wss://<relay-host>/connectwith bearer auth. The server pushes request frames; the client dispatches them to the adapter concurrently and returns response frames matched byrequest_id. Reconnects automatically with exponential backoff. -
Relay server — must expose
/connectand treat reconnects from the same key as an upsert. How callers reach the relay is up to the platform — the spec accommodates single-tenant, multi-tenant, and dynamic provisioning designs.
The full specification is in PROTOCOL.md.
License
spectral-bridge — both the client and the protocol specification — is licensed under the Apache License 2.0. You're free to use, modify, and distribute it, including for commercial purposes. The license includes an explicit patent grant, which means anyone implementing the protocol can do so without worrying about future patent claims from the project's authors.
Contributions are welcome. We use the Apache Individual Contributor License Agreement, which contributors sign once when opening their first pull request. See CONTRIBUTING.md for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spectral_bridge-0.1.2.tar.gz.
File metadata
- Download URL: spectral_bridge-0.1.2.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5746bf1a0699a3c446783b98e5ed6fa593a41bb12edf8664d9d41499b785f73
|
|
| MD5 |
fd717fa5b8c5ebd4d0ef16da65f34d84
|
|
| BLAKE2b-256 |
98dad16745b3b202502334480ef4c5b42bd9d380c0bf5a8963b3a93ce23130c9
|
File details
Details for the file spectral_bridge-0.1.2-py3-none-any.whl.
File metadata
- Download URL: spectral_bridge-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83947943a6ae6343352f1337980e60f3204c2d46c4896df05ffef505c1431b0c
|
|
| MD5 |
c6404d10d6899e91161839c8a01a22a4
|
|
| BLAKE2b-256 |
d5350cc67724f79a5b960cdd36a634c1ab8d6fa48e14b5ebd1bf350d7640ad16
|