Skip to content

Provider Model

nxusKit presents LLMs, local inference servers, rule engines, solvers, and test adapters through one provider interface. Your application chooses a provider_type, sends a ChatRequest, and receives a structured response. The same request/response pattern works whether the backend is OpenAI, Anthropic, Ollama, CLIPS, Z3, Mock, or Loopback.

The goal is portability: application code can switch providers without changing its surrounding orchestration, logging, retry, or licensing logic.

CategoryProvider typesUse when
Cloud LLMsopenai, claude, groq, mistral, fireworks, together, openrouter, perplexityYou need hosted models, managed scaling, or provider-specific model quality.
Local LLMsollama, lmstudio, localYou need local inference, data locality, lower latency, or offline development.
Reasoning enginesclips, z3You need deterministic rule evaluation, constraint solving, or explainable decisions.
Utility providersmock, loopback, mcpYou need tests, integration checks, or model-context tooling.

All providers use the same high-level configuration fields:

{
"provider_type": "openai",
"model": "gpt-4o",
"api_key": "sk-...",
"base_url": "https://api.openai.com/v1",
"timeout_ms": 30000,
"options": {}
}

Only provider_type is always required. API keys can come from explicit configuration, environment variables, or the credential store. See Authentication for the precedence rules.

  1. Create a provider from configuration.
  2. Build a chat request with a model name and messages.
  3. Call chat() for a complete response or chat_stream() for incremental chunks.
  4. Read response content and provider metadata.
use nxuskit::{ChatRequest, Message, NxuskitProvider, ProviderConfig};
let provider = NxuskitProvider::new(ProviderConfig {
provider_type: "openai".into(),
..Default::default()
})?;
let request = ChatRequest::new("gpt-4o")
.with_message(Message::user("Summarize the provider model."));
let response = provider.chat(request)?;
println!("{}", response.content);

Providers advertise capabilities such as streaming, vision, JSON mode, tool calling, deterministic seeds, and local model discovery. Use the capability metadata to choose a provider at runtime instead of hard-coding assumptions.

For provider-specific details, see:

NeedStart with
General hosted chat, tools, and JSON outputCloud LLM provider
Local development without external API callsOllama or LM Studio
Embedded local inference with direct model lifecycle controlIn-process local provider
Deterministic business rulesCLIPS
Constraint solving and optimizationZ3
Unit tests with predictable responsesMock or Loopback