AYXZA Relay is a gateway library that brings OpenAI, Anthropic, Google Gemini, Vertex AI and any OpenAI-compatible endpoint (Groq, DeepSeek, OpenRouter, Ollama, vLLM, llama.cpp) under a single Python interface, with routing profiles, fallback, cost control and a knowledge base.
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 library.
gw.chat() works with any registered modelPure Python library, stateless where possible, with persistence on PostgreSQL + pgvector. No external service dependency beyond the LLM providers themselves.
# 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 | OpenAI | Anthropic | Gemini | Vertex | Ollama |
|---|---|---|---|---|---|
| Chat completion | ● | ● | ● | ● | ● |
| Streaming | ● | — | ● | — | ● |
| Structured output (native) | ● | — | ● | ● | — |
| Function calling | ● | ● | ● | — | ● |
| Embeddings | ● | — | ● | ● | ● |
| Vision · multimodal | ● | ● | ● | ● | ● |
| On-premise · air-gapped | — | — | — | — | ● |
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.
BaseProvider interface.To evaluate an integration, discuss a use case or get a personalized demo on your product.