Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LLM Providers

LLM provider plugins handle communication with AI model APIs. They receive llm.request events, call the external API, and emit llm.response (or streaming chunks).

Available Providers

PluginIDService
Anthropicnexus.llm.anthropicClaude (direct HTTP, no SDK)
OpenAInexus.llm.openaiGPT / o-series (direct HTTP, no SDK)
Gemininexus.llm.geminiGoogle Gemini — public api-key + Vertex AI; thinking, multimodal, code execution, prompt caching
Fallbacknexus.provider.fallbackAutomatic provider failover coordinator
Fanoutnexus.provider.fanoutParallel multi-provider dispatch

Provider Architecture

Providers are low-level plugins that:

  1. Subscribe to llm.request at high priority (10)
  2. Resolve the requested model role via the Model Registry
  3. Apply prompt registry sections to the system prompt
  4. Make the API call (with streaming support)
  5. Emit llm.response or llm.stream.chunk / llm.stream.end

Providers don’t know about agents, tools, or conversations — they only translate between the Nexus event model and the external API.

Structured Output

When ResponseFormat is set on an LLMRequest, providers map it to their native structured output mechanism if supported, or simulate it otherwise.

Capability Matrix

ProviderNative SupportStrategy
OpenAIYesMaps directly to response_format in the API payload
AnthropicNoSimulates via tool-use-as-schema: injects synthetic tool, forces tool choice, unwraps tool call arguments as structured response
GeminiYesMaps to generationConfig.responseMimeType + responseSchema (incompatible JSON Schema keywords stripped)
Other/unknownNoIgnores the field; json_schema gate handles validation downstream

Metadata Flag

Providers set LLMResponse.Metadata["_structured_output"] = true when structured output enforcement was used (native or simulated). Downstream consumers (like the json_schema gate) can check this flag to skip redundant validation.