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
  • LiteLLM routes to 100+ providers with a single class and model-string prefixes
  • HuggingFaceLLM runs 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

Anthropic, Gemini, Ollama, DeepSeek, Azure, Bedrock, Cohere, and 90+ others are all available via LiteLLM using their model-string prefix. See the LiteLLM section below.

What You Get

  • Unified LLMProvider interface: swap providers with a one-line change, no application code changes
  • LiteLLM: single class for 100+ providers using model-string routing
  • Local models: HuggingFaceLLM runs fully on-premise, no API key
  • Streaming: token-by-token output for low-latency UX
  • Custom gateways: point OpenAI at any OpenAI-compatible endpoint via base_url

Choosing a Provider

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

Configuration File Method

Programmatic Setup

Security Best Practices

Never commit API keys to version control. Use environment variables or secure secret management.

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 as llm_provider=:

Provider Comparison

For production extraction pipelines, Groq delivers the best throughput-to-cost ratio. For complex multi-hop reasoning, Claude Opus or GPT-4o provide the highest accuracy.

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.