semantica.llms provides a single consistent API across every major LLM provider:
- Every provider is a drop-in replacement for the
llm_provider=parameter in extractors, reasoners, and agents LiteLLMroutes to 100+ providers with a single class and model-string prefixesHuggingFaceLLMruns fully on-premise: no API key, no network calls- Structured output via
generate_with_schema()for JSON extraction from any provider - Streaming, tool use, and
generate_batch()for bulk inference
Exported Classes
What You Get
- Unified
LLMProviderinterface: swap providers with a one-line change, no application code changes LiteLLM: single class for 100+ providers using model-string routing- Local models:
HuggingFaceLLMruns fully on-premise, no API key - Streaming: token-by-token output for low-latency UX
- Custom gateways: point
OpenAIat any OpenAI-compatible endpoint viabase_url
Choosing a Provider
- Groq: Getting Started
- OpenAI: Production
- Ollama: Local / Air-gapped
- Claude: Reasoning
- DeepSeek: Cost Optimization
Free tier, fastest inference, zero setup friction. Best for development and high-throughput extraction pipelines.Get your free key at console.groq.com.
API Key Setup
Environment Variables (Recommended)
Configuration File Method
Programmatic Setup
Security Best Practices
Providers
LiteLLM: 100+ Providers
LiteLLM is the recommended way to access any provider not directly exported by semantica.llms. Use the provider/model string format:
The full list of supported LiteLLM model strings is at docs.litellm.ai/docs/providers. Use the
provider/model format shown above.Custom / Enterprise Gateways
Any OpenAI-compatible endpoint: internal routing layers, Qwen proxies, or private LLaMA deployments:base_url is validated at construction time. Non-HTTP(S) schemes raise ValueError to prevent SSRF attacks (fixed in v0.5.0).Using in Extractors
All extractors accept any provider asllm_provider=:
Provider Comparison
Defaults and Reproducibility
Documentation examples may showcase stronger models for better developer experience, while implementation defaults prioritize reliability and cost efficiency. Understanding actual defaults helps with reproducible results and consistent benchmarking. Verified Implementation Defaults:
These are the models used when you construct a provider without specifying
model=. Examples throughout this documentation use stronger showcase models. Always pass model= explicitly in production for reproducible results.
Why This Matters:
- Reproducible extraction results across environments
- Consistent baseline performance for benchmarking
- Predictable costs when scaling production workloads
Performance and Reliability Tips
Extraction with Retries
Model Selection by Use Case
Error Handling
- Semantic Extract — Use LLMs for NER and relation extraction.
- Agno Integration — LLM providers in Agno multi-agent teams.
- Reasoning — LLM-backed deductive and abductive reasoning.
- Context — GraphRAG uses LLMs for reasoning over knowledge graphs.
