How to Configure Multiple LLM Providers in SkillSpector: A Complete Guide
SkillSpector provides a pluggable LLM provider framework that supports OpenAI, Anthropic, NVIDIA Build, and NVIDIA Inference APIs, allowing you to configure multiple providers simultaneously through environment variables or instantiate them directly for specific analysis nodes.
NVIDIA's SkillSpector ships with a flexible, pluggable architecture for managing large language model providers. Understanding how to configure multiple LLM providers in SkillSpector enables you to route different analysis tasks to optimal models, implement fallback strategies, or leverage specific provider capabilities for security scanning workflows.
Understanding the LLM Provider Architecture
The framework is built around protocol-based interfaces defined in src/skillspector/providers/base.py.
The Three Core Interface Contracts
Each provider implements three distinct protocols that compose the LLMProvider interface:
ModelMetadataProvider– Supplies token-budget metadata includingcontext_lengthandmax_output_tokensfor specific model configurations.CredentialsProvider– Provides API authentication through environment variables and optional base URL overrides for custom endpoints.ChatModelProvider– Constructs LangChainBaseChatModelinstances via thecreate_chat_model()method for a given model name.
Concrete implementations include OpenAIProvider, AnthropicProvider, AnthropicProxyProvider, NvBuildProvider, and NvInferenceProvider. All inherit from the composite LLMProvider protocol and implement the three core interfaces.
Provider Selection and Configuration
SkillSpector automatically selects providers based on credential availability, or you can force a specific provider through environment configuration.
Automatic Selection Priority
The selection logic resides in src/skillspector/llm_utils.py within the get_llm_provider() function. When SKILLSPECTOR_PROVIDER is unset, the system checks for credentials in this priority order:
OpenAIProvider– RequiresOPENAI_API_KEYAnthropicProvider– RequiresANTHROPIC_API_KEYAnthropicProxyProvider– RequiresANTHROPIC_API_KEYandANTHROPIC_BASE_URLfor Vertex-style endpointsNvBuildProvider– RequiresNV_BUILD_API_KEYandNV_BUILD_BASE_URLNvInferenceProvider– Falls back to the same NVIDIA credentials as the Build provider
The first provider with valid credentials becomes the default. If multiple credential sets exist, the earliest in this list wins.
Forcing a Specific Provider
Override automatic selection by setting the SKILLSPECTOR_PROVIDER environment variable to one of these values:
openai | anthropic | anthropic_proxy | nv_build | nv_inference
Each provider requires specific environment variables:
- OpenAI:
OPENAI_API_KEY - Anthropic:
ANTHROPIC_API_KEY, optionalANTHROPIC_BASE_URL - NVIDIA Build:
NV_BUILD_API_KEY,NV_BUILD_BASE_URL - NVIDIA Inference: Uses the same variables as NVIDIA Build
Model Configuration and Overrides
SkillSpector supports hierarchical model selection through environment variables and registry files.
Environment-Based Model Selection
Model resolution follows a three-tier fallback system implemented in each provider's resolve_model() method:
- Global override – Set
SKILLSPECTOR_MODELto apply across all analysis slots - Slot-specific default – Configure the
SLOT_DEFAULTSdictionary for specific analysis components (e.g.,meta_analyzer) - Provider default – Falls back to the provider's
DEFAULT_MODELconstant (e.g.,OpenAIProvider.DEFAULT_MODEL)
# Global override for all slots
export SKILLSPECTOR_MODEL="claude-sonnet-4-6"
# Slot-specific override
export SKILLSPECTOR_SLOT_meta_analyzer="gpt-4"
Custom Model Registry
For custom model metadata or self-hosted endpoints, point SkillSpector to a YAML registry file:
export SKILLSPECTOR_MODEL_REGISTRY="/path/to/custom_models.yaml"
The registry loader in src/skillspector/providers/registry.py reads this file and supplies token-budget data to the provider's ModelMetadataProvider interface.
Implementing Multiple Providers in Practice
You can configure a single default provider or instantiate multiple providers simultaneously for different analysis nodes.
Basic Single Provider Setup
Force a specific provider and configure its credentials:
import os
from skillspector.llm_utils import get_llm_provider
# Force Anthropic provider
os.environ["SKILLSPECTOR_PROVIDER"] = "anthropic"
os.environ["ANTHROPIC_API_KEY"] = "sk-anthropic-xxxx"
os.environ["ANTHROPIC_BASE_URL"] = "https://api.anthropic.com" # Optional
# Retrieve configured provider
provider = get_llm_provider() # Returns AnthropicProvider instance
# Create LangChain chat model
chat = provider.create_chat_model(
model=provider.resolve_model(),
max_tokens=1024,
timeout=60
)
Mixed Provider Configuration
Instantiate providers directly to use different LLMs for different analysis tasks:
from skillspector.providers.openai import OpenAIProvider
from skillspector.providers.anthropic import AnthropicProvider
# OpenAI for lightweight pattern matching
openai = OpenAIProvider()
static_chat = openai.create_chat_model(
model=openai.resolve_model(),
max_tokens=512
)
# Anthropic for complex semantic analysis
anthropic = AnthropicProvider()
semantic_chat = anthropic.create_chat_model(
model=anthropic.resolve_model(),
max_tokens=2048
)
# Assign to specific nodes
static_node = StaticPatternsNode(chat_model=static_chat)
semantic_node = SemanticSecurityDiscoveryNode(chat_model=semantic_chat)
Because each provider maintains independent credential management through the CredentialsProvider interface, you can freely mix OpenAI, Anthropic, and NVIDIA endpoints within the same SkillSpector execution.
Summary
- SkillSpector uses a protocol-based architecture defined in
src/skillspector/providers/base.pywith three core interfaces:ModelMetadataProvider,CredentialsProvider, andChatModelProvider. - Automatic selection checks for credentials in the order: OpenAI → Anthropic → Anthropic Proxy → NVIDIA Build → NVIDIA Inference.
- Force a specific provider by setting
SKILLSPECTOR_PROVIDERto the desired provider key. - Model overrides support global settings via
SKILLSPECTOR_MODEL, slot-specific defaults throughSLOT_DEFAULTS, or custom registries viaSKILLSPECTOR_MODEL_REGISTRY. - Multiple providers can coexist by instantiating provider classes directly and passing them to specific analysis nodes.
Frequently Asked Questions
What environment variables do I need for each LLM provider?
OpenAI requires OPENAI_API_KEY. Anthropic requires ANTHROPIC_API_KEY with optional ANTHROPIC_BASE_URL for proxy endpoints. NVIDIA providers require NV_BUILD_API_KEY and NV_BUILD_BASE_URL, which work for both NvBuildProvider and NvInferenceProvider.
How does SkillSpector choose which provider to use if I don't specify one?
The system evaluates providers in a hard-coded priority order defined in src/skillspector/llm_utils.py. It selects the first provider where CredentialsProvider can resolve valid credentials from environment variables.
Can I use different LLM providers for different analysis tasks in the same run?
Yes. Instead of relying on the global provider from get_llm_provider(), instantiate specific provider classes directly (e.g., OpenAIProvider(), AnthropicProvider()) and pass them to individual node constructors. Each provider maintains independent credential and model resolution logic.
How do I override the default model for a specific analysis slot?
Set the SKILLSPECTOR_MODEL environment variable to override all slots globally, or use SKILLSPECTOR_SLOT_<slot_name> for specific analysis components. The resolve_model() method in each provider checks these variables before falling back to the provider's DEFAULT_MODEL constant.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →