Connecting an LLM
NEXUS is model-agnostic. The kernel runs without any model, connect a provider when you need inference. Three paths: cloud API, local open-source model, or runtime registration.
Option A: Cloud Providers
Section titled “Option A: Cloud Providers”The fastest way to get inference running. Set an env var and start the kernel.
OpenAI
Section titled “OpenAI”export NEXUS_OPENAI_KEY=sk-...export NEXUS_DEFAULT_PROVIDER=openaionexus runAvailable models: gpt-4o, gpt-4o-mini, o3, o3-mini. Default: gpt-4o-mini. Override with NEXUS_OPENAI_MODEL.
Anthropic
Section titled “Anthropic”export NEXUS_ANTHROPIC_KEY=sk-ant-...export NEXUS_DEFAULT_PROVIDER=anthropiconexus runAvailable models: claude-opus-4-20250514, claude-sonnet-4-20250514, claude-haiku-4-5-20251001. Default: claude-sonnet-4-20250514. Override with NEXUS_ANTHROPIC_MODEL.
Option B: Local Open-Source Models
Section titled “Option B: Local Open-Source Models”Run any model locally for full data sovereignty. NEXUS connects to any server exposing an OpenAI-compatible or llama.cpp HTTP API.
llama.cpp
Section titled “llama.cpp”# Installbrew install llama.cpp # macOS# or build from source: https://github.com/ggerganov/llama.cpp
# Download a model (GGUF format)huggingface-cli download Qwen/Qwen3-8B-GGUF \ qwen3-8b-instruct-q4_k_m.gguf \ --local-dir ~/.local/share/nexus/models/
# Start the serverllama-server \ --model ~/.local/share/nexus/models/qwen3-8b-instruct-q4_k_m.gguf \ --port 8384 \ --ctx-size 8192
# Start NEXUS (auto-connects to localhost:8384)onexus runOllama
Section titled “Ollama”# Install from https://ollama.comollama pull qwen3:8bollama serve # starts on port 11434
# Point NEXUS at OllamaNEXUS_LLM_PORT=11434 onexus runvllm serve Qwen/Qwen3-8B --port 8384onexus runRecommended Open-Source Models
Section titled “Recommended Open-Source Models”All MIT or Apache 2.0 licensed:
| Model | Notes |
|---|---|
| Qwen 3 8B | Default recommendation: good balance of speed and quality |
| Qwen 3 32B | Complex reasoning, long-context tasks |
| DeepSeek-R1 7B | Strong code generation and technical analysis |
| Phi-4 Mini | Fast responses, lightweight |
| Llama 3.1 8B | General purpose, well-rounded |
| Gemma 2 9B | Strong multilingual support |
Option C: Runtime Registration
Section titled “Option C: Runtime Registration”Register providers while the kernel is already running. No restart required.
# Start the kernel with no modelonexus serve
# Register OpenAI at runtimecurl -X POST http://localhost:8000/api/providers \ -H "Content-Type: application/json" \ -d '{"provider": "openai", "api_key": "sk-...", "model": "gpt-4o", "set_default": true}'
# Register Anthropic at runtimecurl -X POST http://localhost:8000/api/providers \ -H "Content-Type: application/json" \ -d '{"provider": "anthropic", "api_key": "sk-ant-...", "set_default": true}'
# Register a local model servercurl -X POST http://localhost:8000/api/providers \ -H "Content-Type: application/json" \ -d '{"provider": "local", "base_url": "http://localhost:11434", "set_default": true}'Provider Management
Section titled “Provider Management”# List all providers and their healthcurl http://localhost:8000/api/providers
# Switch default providercurl -X POST http://localhost:8000/api/providers/default/anthropic
# Remove a providercurl -X DELETE http://localhost:8000/api/providers/openaiThe provider router automatically falls back to the default if a requested provider is unhealthy.
Remote Endpoints
Section titled “Remote Endpoints”Serve the model on a different machine while NEXUS runs locally:
# On the model serverllama-server --model qwen3-32b-q4.gguf --host 0.0.0.0 --port 8384
# On the NEXUS machine -- register the remote servercurl -X POST http://localhost:8000/api/providers \ -H "Content-Type: application/json" \ -d '{"provider": "local", "base_url": "http://model-server.local:8384", "set_default": true}'All other NEXUS behavior (memory, audit, trust) remains local. Only LLM inference is remote.
Verifying the Connection
Section titled “Verifying the Connection”onexus statusOr check provider health via the API:
curl http://localhost:8000/api/providersModules that require inference will fail gracefully with an error message if no provider is reachable. Modules that do not use the LLM (Oracle, Sentry) continue to function normally.