Skip to main content

The open standard AI gateway for production systems — PII protection, audit trails, reliability, and cost control as composable interceptors.

Project description

Gavio — Python SDK

The open standard AI gateway for production systems. PII protection, audit trails, reliability, and cost control as composable interceptors.

gavio sits between your application and any LLM provider. The same request passes through a pre/post interceptor chain — PII redaction, retries, cost tracking, audit logging — before and after the provider call.

Part of the Gavio project. MIT licensed.

Install

pip install gavio            # zero mandatory dependencies
pip install gavio[dev]       # + pytest, ruff, mypy

Requires Python 3.10+.

Quick start (dev mode — no API key, no network)

import asyncio
from gavio import Gateway
from gavio.interceptors.pii import PiiGuard

gw = (
    Gateway.builder()
    .dev_mode(True)                 # MockProvider + stdout audit
    .use(PiiGuard())                # redact PII before it leaves the process
    .build()
)

async def main():
    resp = await gw.complete(
        messages=[{"role": "user", "content": "Email jan@example.com about NL91ABNA0417164300"}],
        agent_id="demo",
    )
    print(resp.content)             # PII restored in the reply
    print(f"cost=${resp.cost_usd:.6f} latency={resp.latency_ms}ms")
    print("pii types:", resp.audit.pii_entity_types)

asyncio.run(main())

Real providers

from gavio import Gateway, Provider
from gavio.interceptors.pii import PiiGuard
from gavio.interceptors.audit import AuditInterceptor
from gavio.interceptors.reliability import RetryInterceptor, TimeoutPolicy

gw = (
    Gateway.builder()
    .provider(Provider.ANTHROPIC)          # reads ANTHROPIC_API_KEY
    .model("claude-sonnet-4-6")
    .use(PiiGuard(sensitivity="strict"))
    .use(AuditInterceptor(sink="stdout://"))
    .use(TimeoutPolicy(timeout_seconds=30))
    .use(RetryInterceptor(max_attempts=3))
    .build()
)

resp = await gw.complete(messages=[{"role": "user", "content": "Hi"}])

OPENAI_API_KEY / Provider.OPENAI work the same way.

What ships in v0.1.0

  • CoreGateway fluent builder, InterceptorChain, GavioRequest / GavioResponse, UUID v7 trace_id, agent_id / parent_trace_id.
  • PII Guard (F-SEC-01) — Email, IBAN (mod-97), BSN (11-proef), CreditCard (Luhn), Phone, IP, SSN scanners, redact/mask/tag/block, restore.
  • Secret Scanner (F-SEC-04) — API keys, JWTs, PEM keys, DB URLs.
  • Reliability — retry with backoff (F-REL-01), fallback chain (F-REL-02), timeout (F-REL-07).
  • Cost tracking (F-GOV-01) — per-request cost_usd.
  • Audit (F-OBS-01)AuditRecord + StdoutSink (F-OBS-05).
  • Dev mode (F-DX-01) and dry-run mode (F-DX-02).
  • Providers — OpenAI, Anthropic, Mock.

See the Python guide and CHANGELOG.md.

Tests

pip install -e ".[dev]"
pytest tests/unit -v
ruff check gavio

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

gavio-0.1.0.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

gavio-0.1.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file gavio-0.1.0.tar.gz.

File metadata

  • Download URL: gavio-0.1.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gavio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b576476f2838da344a273425e61b02aad9edd5a84abafab422f8945d775fb6f
MD5 d6466ec78f6bdfe3b45dbb64f6ae2a55
BLAKE2b-256 afea035c391f70c6be86e06b302a878ee44ebd174a1215f327b0cefc8faf98e6

See more details on using hashes here.

File details

Details for the file gavio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gavio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gavio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abb1ac9c5b1f5060ed78ec54b3b76077cf0c058f0fdf82ca058cb6354e28b199
MD5 a281287ede7f934242a026ff127e8ae3
BLAKE2b-256 bd161d0c64aa5abb4b3afcd40fa95f49ea01fba07346f6c7455e3a7205473d3b

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