Which LLM Providers Are Supported by Semantica's Vendor-Neutral Facade?
Semantica supports nine major LLM providers—OpenAI, Anthropic, Groq, Google Gemini, DeepSeek, Ollama, Novita, HuggingFace, and LiteLLM—through a unified semantica.llms facade that standardizes authentication, request formatting, and response handling behind consistent generate and generate_typed methods.
The semantica-agi/semantica repository implements a vendor-neutral abstraction layer that insulates application logic from provider-specific API differences. Located under the semantica.llms package, this facade enables hot-swapping between cloud-hosted and local models while maintaining identical method signatures for text generation and structured output extraction.
Core Cloud Providers
The facade wraps industry-leading cloud APIs in dedicated modules, each exposing the common interface defined in the package initialization.
OpenAI
Source: [semantica/llms/openai.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/openai.py)
The OpenAI wrapper provides access to GPT-4, GPT-3.5-Turbo, and newer flagship models. It handles chat completions and embeds the standard generate method that the rest of the codebase consumes.
Anthropic Claude
Source: [semantica/llms/anthropic.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/anthropic.py)
This module wraps Anthropic's Claude family of models, normalizing Claude's unique message format to match the facade's expected inputs and outputs.
Google Gemini
Source: [semantica/llms/gemini.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/gemini.py)
The Gemini adapter interfaces with Google's Gemini API, translating between Google's content generation parameters and the standard facade schema.
Groq
Source: [semantica/llms/groq.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/groq.py)
Groq's Llama-3-8B-Instruct and similar endpoints are supported through this high-performance wrapper, which leverages Groq's inference-optimized infrastructure.
DeepSeek
Source: [semantica/llms/deepseek.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/deepseek.py)
This wrapper connects to DeepSeek's chat models, integrating their API structure into the unified interface.
Novita AI
Source: [semantica/llms/novita.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/novita.py)
The Novita module provides access to Novita AI's LLM endpoints, extending the facade to this emerging provider.
HuggingFace Inference API
Source: [semantica/llms/huggingface.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/huggingface.py)
This wrapper connects to HuggingFace's Inference API, allowing usage of thousands of open-source models hosted on the HuggingFace Hub.
Local and Meta-Adapters
Beyond direct cloud APIs, the facade supports local execution and universal routing.
Ollama
Source: [semantica/llms/ollama.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/ollama.py)
The Ollama wrapper enables inference against locally hosted models. It supports any model compatible with the Ollama runtime, including quantized Llama, Mistral, and custom fine-tuned weights running on private infrastructure.
LiteLLM Universal Adapter
Source: [semantica/llms/litellm.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/litellm.py)
The LiteLLM module acts as a thin forwarding layer to the LiteLLM library, which itself supports dozens of providers including Azure OpenAI, Cohere, Mistral AI, and Replicate. This adapter allows runtime provider switching without code changes.
Provenance and Observability
Source: [semantica/llms/llms_provenance.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/llms_provenance.py)
Semantica extends the base facade with provenance-enabled wrappers that decorate any provider with request-level telemetry. These wrappers capture timestamps, cost estimates, and latency metrics for every generate call, storing them in last_call_cost and last_call_latency attributes.
Implementation Architecture
All provider modules are centralized in [semantica/llms/__init__.py](https://github.com/semantica-agi/semantica/blob/main/semantica/llms/__init__.py), which serves as the single entry point:
# semantica/llms/__init__.py
from .openai import OpenAI
from .anthropic import Anthropic
from .groq import Groq
from .gemini import Gemini
from .deepseek import DeepSeek
from .ollama import Ollama
from .novita import Novita
from .huggingface import HuggingFace
from .litellm import LiteLLM
Higher-level components import from this facade rather than provider-specific modules, ensuring vendor-neutral pipelines for extraction, reasoning, and generation tasks.
Usage Examples
Basic Text Generation
from semantica.llms import OpenAI
llm = OpenAI()
response = llm.generate(prompt="Explain the importance of knowledge graphs.")
print(response.text)
Structured Output with Anthropic
from semantica.llms import Anthropic
llm = Anthropic()
typed = llm.generate_typed(
prompt="Extract entities from the sentence.",
schema={"type": "array", "items": {"type": "string"}}
)
print(typed)
Runtime Provider Switching via LiteLLM
from semantica.llms import LiteLLM
llm = LiteLLM(provider="azure", model="gpt-35-turbo")
resp = llm.generate("Summarize the following paragraph.")
print(resp.text)
Enabling Cost and Latency Tracking
from semantica.llms.llms_provenance import GroqLLMWithProvenance
llm = GroqLLMWithProvenance(provenance=True)
resp = llm.generate("What are the key challenges in LLM alignment?")
print(resp.text)
print("Cost:", llm.last_call_cost)
print("Latency:", llm.last_call_latency)
Summary
- Semantica's vendor-neutral facade resides in the
semantica.llmspackage and exposes uniformgenerateandgenerate_typedmethods across all providers. - Nine primary providers are supported: OpenAI, Anthropic, Groq, Gemini, DeepSeek, Ollama, Novita, HuggingFace, and LiteLLM.
- LiteLLM integration extends support to dozens of additional cloud providers through a single adapter.
- Ollama support enables local, private inference without external API dependencies.
- Provenance wrappers in
llms_provenance.pyadd production-ready observability for cost and latency tracking.
Frequently Asked Questions
How do I switch between LLM providers without changing my application code?
Import your desired provider from semantica.llms and instantiate it. Because all providers implement identical generate and generate_typed signatures, you can swap OpenAI() for Anthropic() or Groq() by changing only the import and instantiation lines. For dynamic runtime switching, use the LiteLLM adapter with the provider parameter.
Can I use Semantica with local models instead of cloud APIs?
Yes. The Ollama wrapper in semantica/llms/ollama.py supports any model running on a local Ollama instance. This includes quantized versions of Llama, Mistral, and custom fine-tuned models, enabling fully private inference without data leaving your infrastructure.
What methods are standardized across all LLM providers in the facade?
Every provider wrapper exposes generate(prompt) for text completion and generate_typed(prompt, schema) for structured, schema-validated outputs. Additional methods vary by provider, but these two form the core interface that higher-level Semantica components rely on for vendor-neutral operations.
How does Semantica track API costs and latency?
The llms_provenance.py module provides decorator classes like GroqLLMWithProvenance that wrap any base provider. When provenance=True is set, these wrappers capture last_call_cost and last_call_latency attributes after each request, enabling detailed monitoring of production inference expenses.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →