AYXZA Relay
Commercial documentation
Commercial Technical Providers Contact
Universal AI Gateway · Python 3.12 · Self-hosted

One SDK.
Every AI model.

AYXZA Relay is a gateway that brings OpenAI, Anthropic, Google Gemini, Vertex AI and any OpenAI-compatible endpoint (Groq, DeepSeek, OpenRouter, Ollama, vLLM, llama.cpp) under one interface, with routing profiles, fallback, cost control and a knowledge base. It runs as a Python library inside the application or as an HTTP service with one token per application, and it underpins AYXZA Chat, the AI assistant for the people in the company.

Integrated providers
5+
cloud + local
Unified API
1
python library or HTTP
Self-hosted
100%
no vendor lock
Automated tests
3200+
suite verified at every release
Commercial section · 01 / 03

Perché AYXZA Relay

Adding AI to a product is no longer "calling an API". It means juggling five vendors, containing costs, guaranteeing uptime and protecting data. AYXZA Relay solves all of this with a single component.

The problem Without a gateway
  • ✗Duplicated code for each provider (OpenAI, Anthropic, Gemini…)
  • ✗Technical lock-in: changing model = rewriting the integration
  • ✗Costs out of control, no per-tenant visibility
  • ✗One provider down = service down
  • ✗Sensitive data sent to the cloud, no on-prem option
  • ✗RAG / knowledge base built from scratch every time
The solution With AYXZA Relay
  • +Single API: gw.chat() works with any registered model
  • +Provider switch via config, zero refactoring
  • +Costs tracked per call, user and model, with quotas and budgets per tenant
  • +Automatic fallback to a backup model, with a per-provider circuit breaker
  • +Local engines (Ollama, vLLM, llama.cpp) for sensitive data, with no external network
  • +Built-in Knowledge Base module with pgvector

Typical use cases

01
Multi-tenant SaaS
Per-customer cost tracking, per-plan limits, different models per tier. Out of the box.
02
On-premise enterprise
Local Ollama for confidential data, optional cloud fallback for non-sensitive tasks.
03
Corporate knowledge base
RAG over internal documents with pgvector, auto re-indexing, per-tenant isolation.
04
Agents & chains
Multi-step orchestration, native structured output (Gemini, OpenAI) and multimodal attachments (PDF, images) on prompts.
05
Provider migration
The model is changed from configuration or from the console, without touching application code.
06
High availability
Transparent fallback: if a provider does not answer, the request moves to the declared backup model with no code changes.

Governance and observability

01
Routing profiles
Each request stays within its declared class, local, European cloud or cloud, and moves through the candidates in order.
02
Resilience
Backup models, a per-provider circuit breaker, several keys per provider with an automatic pause for the failing one, and an on-demand health probe. On native providers every call has a time limit, which the configuration can change: 120 seconds per attempt and, when streaming, until the first chunk; 60 seconds between two chunks. When the profile still has a backup model, the first chunk is awaited for 45 seconds before moving on to it.
03
Web console
A web console manages providers, models, keys, prompts, quotas and the knowledge base, with a test bench for chat and embeddings. It starts with one command and, by default, listens only on the machine itself.
04
Versioned prompts
Prompts are versioned and validated: every run records the version used and retries when the output fails its checks; on saving, a warning flags the fields that the template and the output schema do not share. Prompts can also live in files, one folder per prompt reviewed together with the application's code: loading is all or nothing, creates a version only when the content changes, and the console shows where each version came from.
05
Documents and confidence
PDF and Word documents enter the knowledge base; answers carry a confidence that combines the model's judgement with the relevance of the retrieved passages, and a question outside the corpus returns no answer without calling the model.
06
Quotas and budgets
Spending quotas per user and per tenant, with actual spend set against the cap. Tokens the provider serves from its cache are counted separately and charged at their own price, not at the full input price.
07
Data retention
Calls older than a given date are anonymised after a dry run, by user, user subtree or source, on the activity and knowledge-base archive branches; optionally content rows are deleted too, never cost rows. A second identical pass touches nothing. A pass can be limited to individual runs, or empty only the texts and keep rows and costs.
08
OpenTelemetry
Native OpenTelemetry traces on every call, ready for any collector.
09
Tool loop
The model calls the application's functions and Relay manages the turns until the answer.
10
Price list
A reference price list ships in the package, with source, reading date and announced changes; the forge-ai listino command compares the rates of the registered models and aligns them, without rewriting the cost of past calls.
11
Required class
Chat, embeddings, meta-prompts and the knowledge base can require a confidentiality class: a call to a provider of a different class is refused before any text leaves, at every fallback hop.
12
Web search
On profiles that declare it, the model searches with Google on Vertex: sources, searches and Google's box come back with the answer, streaming included, and the cost per search counts towards quotas and budgets. The text of the searches is not logged.
13
Personal data filter
A local corrector, with no network, replaces email addresses, tax codes, IBANs, cards, VAT numbers, phone numbers, dates of birth, addresses with a street number and the terms given by the caller with numbered placeholders, then puts the values back in the answer. It works in turns with web search, on by default on every profile, and in every turn that asks for anonymisation, tools included: the application's functions receive the real values, the model the placeholders, and even pieces of values already recognised are removed from the results. Only counts are logged.
14
Model verification
The forge-ai verifica command sends a model, or a whole profile, minimal real requests for every declared capability, text, image, PDF, JSON with schema, tools and vectors, and keeps the report.
15
Checked vectors
Every embedding response is checked: as many vectors as texts, of the requested size. The task, document or query, is translated for each model, and when the provider does not declare tokens Relay estimates them, so costs and quotas do not stay at zero.
16
HTTP service
The same gateway runs as an HTTP service, in a single process, shared by several applications: chat, streaming included, embeddings, knowledge base, meta-prompts, speech synthesis and users. Each application has its own token, revocable and with an expiry, tied to its branch of users and written on every call, and its own prompts and knowledge base sources, which it manages through the API: prompt folders with a dry run, documents uploaded without duplicates thanks to their hash, background reindexing with a job to follow. A provider key loaded on a user applies to its whole branch. A Python client with the same shape as the gateway talks to the service, the API contract grows only by additions, and a test page with no data and a container example, with the database on no public port, come with the interface.
17
AYXZA Chat
The AI assistant for the people in the company is a product of its own, AYXZA Chat, built on Relay and installed alongside it: its answers go through Relay's profiles, every call lands in its cost log, and conversations, attachments and memory follow its retention rules. It can also be embedded in the pages of another application, which becomes its host.
18
Speech synthesis
A text becomes audio in the chosen voice, on a model or through a profile with fallback across candidates, on the models that declare the capability. The provider's original file comes back intact with its provenance statement, and every attempt stays in the log as a call.
Technical section · 02 / 03

Architecture

Python library, stateless where possible, with persistence on PostgreSQL + pgvector. The same code is served as an HTTP service and as AYXZA Chat, each in a single process. No external service dependency beyond the LLM providers themselves.

Layered architecture
From the client application to providers, through the core gateway.
flowchart TB subgraph CLIENT["CLIENT APPLICATIONS"] A1["Web App"] A2["Backend API"] A3["CLI / Scripts"] end PP(["Persone"]) subgraph FORGE["AYXZA Relay · Gateway"] SV["Servizio HTTP
/v1 · token per applicazione"] CH["AYXZA Chat
conversazioni · progetti"] GW["Unified API
gw.chat · gw.embedding · gw.kb"] SV --> GW CH --> GW subgraph CORE["Core Services"] R["Profiles
routing"] T["Tracking
cost · tenant · model"] F["Fallback
provider failover"] K["Knowledge Base
RAG + pgvector"] end GW --> R R --> T T --> F GW -.-> K end subgraph PROV["LLM PROVIDERS"] P1["OpenAI"] P2["Anthropic"] P3["Google Gemini"] P4["Google Vertex"] P5["OpenAI-compatible
Ollama · vLLM · llama.cpp"] end DB[("PostgreSQL
+ pgvector")] CLIENT --> GW CLIENT --> SV PP --> CH F --> P1 F --> P2 F --> P3 F --> P4 F --> P5 T --> DB K --> DB
Request flow with fallback
Primary provider unavailable, automatic failover to secondary.
sequenceDiagram autonumber participant App as Client App participant Relay as AYXZA Relay participant P1 as OpenAI primary participant P2 as Anthropic fallback participant DB as PostgreSQL App->>Relay: gw.chat(ChatRequest(profilo="standard")) Relay->>P1: POST /v1/chat/completions P1-->>Relay: 503 Service Unavailable Note over Relay: Hop to the backup model Relay->>P2: POST /v1/messages P2-->>Relay: 200 OK + tokens Relay->>DB: log(tenant, model, cost, latency) Relay-->>App: response (transparent)
RAG · Knowledge Base pipeline
Ingestion → chunking → embedding → retrieval → generation.
flowchart LR D["Documents
PDF · Word · text"] S["Source Registry
hash-based updates"] CH["Chunker
shared utility"] EM["Embedder
gemini-embedding-2
768-dim"] VS[("pgvector
HNSW index")] Q["User query"] QE["Query embedding"] RT["Retrieval
global + tenant chunks"] GEN["LLM Generation
any provider"] D --> S --> CH --> EM --> VS Q --> QE --> RT VS -.-> RT RT --> GEN
API in action
A few lines for chat, profile routing, structured output and answers from the knowledge base.
# 1. Setup: providers, models and keys are registered once
import os
from forge_ai import ChatRequest, ForgeAIConfig, Gateway, Message

config = ForgeAIConfig(
    database_url=os.environ["FORGE_AI_DATABASE_URL"],
    fernet_key=os.environ["FORGE_AI_FERNET_KEY"],
)

with Gateway(config) as gw:
    # 2. Direct chat on a provider and a model
    r = gw.chat(ChatRequest(
        provider="gemini",
        modello="gemini-2.5-flash",
        messaggi=[Message(role="user", content="Summarise this contract in 3 points")],
    ))
    print(r.testo, r.costo, r.provider, r.latenza_ms)

    # 3. Profile routing: candidates and fallback live in the configuration
    r = gw.chat(ChatRequest(
        profilo="standard",
        messaggi=[Message(role="user", content="...")],
    ))

    # 4. Native structured output with JSON Schema
    r = gw.chat(ChatRequest(
        provider="openai",
        modello="gpt-4o-mini",
        messaggi=[Message(role="user", content="Extract the data from this invoice...")],
        output_schema={"type": "object",
                       "properties": {"totale": {"type": "number"}, "iva": {"type": "number"}},
                       "required": ["totale", "iva"], "additionalProperties": False},
    ))

    # 5. Knowledge base: answer with confidence
    esito = gw.kb.interroga(
        "What is the expense reimbursement policy?",
        codice_prompt="qa_policy",
        app_codice="intranet",
    )
    print(esito.risposta, esito.confidenza_finale)
Capability matrix
Capability OpenAI Anthropic Gemini Vertex Ollama
Chat completion●●●●●
Streaming●●●●●
Structured output (native)●—●●—
Function calling●●●●●
Embeddings●—●●●
Vision · multimodal●●●●●
On-premise · air-gapped————●
Native PDF input—●●●—
Web search———●—
Speech synthesis——●——
Requirements
  • Python 3.12+
  • PostgreSQL 16+ with the pgvector extension
  • API keys for the chosen providers (not needed for local engines)
  • A local OpenAI-compatible engine (Ollama, vLLM, llama.cpp) for on-premise models
Tech stack
  • SQLAlchemy 2.x
  • Pydantic v2 for validation and schemas
  • Alembic for database migrations
  • Retries with exponential backoff and jitter
  • Suite of more than 3,200 tests, with public contracts verified at every release
  • FastAPI and uvicorn for the HTTP service and the chat, in the optional [server] and [chat] extras
Supported providers · 03 / 03

Provider integrati

All major cloud LLM vendors, plus an OpenAI-compatible adapter reaching cloud engines (Groq, DeepSeek, OpenRouter) and local ones (Ollama, vLLM, llama.cpp), air-gapped deployments included.

OpenAI
GPT and o-series models
Frontier reasoning, full function calling, native structured output.
Anthropic
Claude Opus · Sonnet · Haiku
Long-context (200K+), excellent for long reasoning and document analysis.
Google Gemini
Gemini 2.5 and 3 · gemini-embedding-2
Native multimodal, 768-dim embeddings, configurable thinking levels.
Google Vertex AI
Enterprise GCP · European region by default
The same Gemini models on Google Cloud, with GCP billing, the European multi-region as default region, streaming, tool loop and web search with Google.
Ollama
Llama · Mistral · Qwen · local
100% local execution, zero external network, ideal for sensitive data and GDPR. The same OpenAI-compatible adapter also reaches cloud engines (Groq, DeepSeek, OpenRouter). Models that cannot read PDFs receive them as images, one per page.
Custom provider
extensible api
Adding a new provider takes ~150 lines of Python implementing the BaseProvider interface.

Contact us

To evaluate an integration, discuss a use case or get a personalized demo on your product.

Contact us →