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.
Full documentation: spectral.principled.app/docs
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. What crosses the boundary depends on the endpoint your adapter serves: the chat and Responses endpoints forward the AI system's response to a test prompt (and, for Responses, its tool calls), and /v1/spectrograph forwards the session's events, including tool arguments, sub-agent prompts and handoffs. 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 the protocol's adapter endpoints (see above for what each one forwards). Nothing else is forwarded.
Quickstart
Install
pip install spectral-bridge
# Include the built-in pass-through adapter:
pip install "spectral-bridge[pass-through]"
Connect
Set your Spectral API 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 \
--adapter pass-through \
--target <your-ai-system-url>
This starts the adapter locally, connects to the Spectral relay, and begins forwarding requests.
The same setup is also available as a container image — no ports to publish, since all connections are outbound:
docker run -d --restart always --read-only --cap-drop ALL \
-e SPECTRAL_BRIDGE_API_KEY=<your-api-key> \
-e TARGET_URL=<your-ai-system-url> \
ghcr.io/principled-intelligence/spectral-bridge:latest
Using another platform? spectral-bridge works with any relay server that implements the open protocol. Point it at your platform's relay with --relay-url wss://relay.example.com/connect (or the SPECTRAL_BRIDGE_RELAY_URL environment variable; RELAY_URL in Docker).
Adapters
An adapter is a thin translation layer that sits between spectral-bridge and your AI system. It serves POST /v1/chat/completions (Chat Completions API) and/or POST /v1/responses (Responses API), using standard OpenAI request and response shapes, or POST /v1/spectrograph (session events, see the protocol). An adapter can implement any of them; the relay client forwards each request to the endpoint it names.
Adapters can be written in any language. Any process, container, or script that serves one of those endpoints 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/completions,POST /v1/responsesand/orPOST /v1/spectrographqualifies. The chat and Responses endpoints forward the AI system's response to the test prompt (and, for Responses, its tool calls);/v1/spectrographforwards the session's events, including tool arguments, sub-agent prompts and handoffs. 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.
Metadata
Release files for spectral-bridge 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spectral_bridge-0.6.0.tar.gz | 80.9 kB | Without provenance | Details for spectral_bridge-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spectral_bridge-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for spectral_bridge-0.6.0-py3-none-any.whl |
Total release size: 100.0 kB
Release files / spectral_bridge-0.6.0.tar.gz
| Download URL | spectral_bridge-0.6.0.tar.gz |
|---|---|
| Size | 80.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4df16fd7efc67a715ccadd8a58faa5f441366881b64587a5c1e2390cb2a78b9b
|
|
BLAKE2b-256 checksum How to use checksums |
f6b15e8ca13986ca6a1714b808aa7d883c9b537289fb6efa1b6fa5da74f81914
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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}
|
Release files / spectral_bridge-0.6.0-py3-none-any.whl
| Download URL | spectral_bridge-0.6.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42fd712fe79947d6129e7be388709c804ea07882d31ea3e6cd680e4fde01cc9f
|
|
BLAKE2b-256 checksum How to use checksums |
d5bfdc8e8a5ca99e93db9c139e3b4bea31f6451129483c506d09e95166f9d480
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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}
|
Security for spectral-bridge 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.