How to Configure LLM Providers for SkillSpector: A Complete Guide
SkillSpector uses a pluggable provider framework that automatically selects the first available provider based on environment variables, or you can force a specific provider by setting SKILLSPECTOR_PROVIDER to one of five supported options.
Managing multiple LLM backends in NVIDIA's SkillSpector requires understanding its provider interface system. The repository implements a flexible configuration mechanism that supports OpenAI, Anthropic, and NVIDIA APIs while allowing custom model registries and per-slot provider assignments.
Understanding the LLM Provider Architecture
SkillSpector's provider system is built around three core interfaces defined in src/skillspector/providers/base.py. Each concrete provider implements these protocols to standardize credential management, metadata retrieval, and model instantiation.
The composite LLMProvider protocol unifies three specific interfaces:
- ModelMetadataProvider: Supplies token-budget information including
context_lengthandmax_output_tokens - CredentialsProvider: Returns API keys and optional base URLs for client initialization
- ChatModelProvider: Constructs LangChain
BaseChatModelinstances for specific model names
All provider implementations (OpenAIProvider, AnthropicProvider, AnthropicProxyProvider, NvBuildProvider, and NvInferenceProvider) inherit from this protocol structure, ensuring consistent behavior across different LLM backends.
Provider Selection Logic
SkillSpector selects providers through a cascading credential detection system in src/skillspector/llm_utils.py. The get_llm_provider() function evaluates environment variables in a hard-coded priority order.
Automatic Provider Detection
When SKILLSPECTOR_PROVIDER is unset, SkillSpector scans for credentials in this sequence:
- OpenAI (
OpenAIProvider) - RequiresOPENAI_API_KEY - Anthropic (
AnthropicProvider) - RequiresANTHROPIC_API_KEY - Anthropic Proxy (
AnthropicProxyProvider) - UsesANTHROPIC_API_KEYwithANTHROPIC_BASE_URLfor Vertex-style endpoints - NVIDIA Build (
NvBuildProvider) - RequiresNV_BUILD_API_KEYandNV_BUILD_BASE_URL - NVIDIA Inference (
NvInferenceProvider) - Falls back to NVIDIA Build credentials
The first provider with valid credentials becomes the default.
Explicit Provider Configuration
Override automatic selection by setting the environment variable:
export SKILLSPECTOR_PROVIDER=anthropic
Valid values are: openai, anthropic, anthropic_proxy, nv_build, or nv_inference.
Configuring Provider Credentials
Each provider requires specific environment variables for authentication and endpoint configuration.
OpenAI
export OPENAI_API_KEY=sk-openai-xxxx
Anthropic
export ANTHROPIC_API_KEY=sk-anthropic-xxxx
Anthropic Proxy
export ANTHROPIC_API_KEY=sk-anthropic-xxxx
export ANTHROPIC_BASE_URL=https://your-proxy.example.com/v1
NVIDIA Build
export NV_BUILD_API_KEY=sk-nv-build-xxxx
export NV_BUILD_BASE_URL=https://api.nvidia.com/v1
NVIDIA Inference
Uses the same variables as NVIDIA Build, functioning as a fallback when Build credentials are present but SKILLSPECTOR_PROVIDER is not explicitly set to nv_inference.
Model Selection and Overrides
Each provider defines a DEFAULT_MODEL constant (e.g., OpenAIProvider.DEFAULT_MODEL). SkillSpector resolves the final model name through a three-tier hierarchy implemented in each provider's resolve_model() method.
Environment-Based Model Overrides
Set these variables to customize model selection:
SKILLSPECTOR_MODEL: Global override affecting all analysis slotsSKILLSPECTOR_SLOT_<slot_name>: Slot-specific override (e.g.,SKILLSPECTOR_SLOT_meta_analyzer)- Provider
SLOT_DEFAULTS: Dictionary mapping slots to models within the provider class
Custom Model Registry
Point to a custom YAML file containing model metadata:
export SKILLSPECTOR_MODEL_REGISTRY=/path/to/custom_models.yaml
The registry loader in src/skillspector/providers/registry.py reads this file to supply token-budget data to providers.
Using Multiple Providers Simultaneously
SkillSpector's node graph supports different providers for different analysis slots. Instantiate providers directly rather than relying on get_llm_provider():
from skillspector.providers.openai import OpenAIProvider
from skillspector.providers.anthropic import AnthropicProvider
openai = OpenAIProvider()
anthropic = AnthropicProvider()
static_chat = openai.create_chat_model(
model=openai.resolve_model(),
max_tokens=512,
)
semantic_chat = anthropic.create_chat_model(
model=anthropic.resolve_model(),
max_tokens=1024,
)
Complete Configuration Example
Configure SkillSpector to use Anthropic with custom model settings:
import os
from skillspector.llm_utils import get_llm_provider, get_metadata_provider
# Force specific provider
os.environ["SKILLSPECTOR_PROVIDER"] = "anthropic"
os.environ["ANTHROPIC_API_KEY"] = "sk-anthropic-xxxx"
# Optional: custom endpoint
os.environ["ANTHROPIC_BASE_URL"] = "https://my-proxy.example.com/v1"
# Model overrides
os.environ["SKILLSPECTOR_MODEL"] = "claude-sonnet-4-6"
os.environ["SKILLSPECTOR_MODEL_REGISTRY"] = "/path/to/custom_models.yaml"
# Retrieve configured provider
provider = get_llm_provider()
metadata = get_metadata_provider()
# Create LangChain model
chat = provider.create_chat_model(
model=provider.resolve_model(),
max_tokens=1024,
timeout=60,
)
Summary
- SkillSpector implements a pluggable provider framework in
src/skillspector/providers/base.pywith three core interfaces for metadata, credentials, and chat model creation - Automatic selection scans for credentials in order: OpenAI, Anthropic, Anthropic Proxy, NVIDIA Build, then NVIDIA Inference
- Use
SKILLSPECTOR_PROVIDERenvironment variable to force a specific provider (openai,anthropic,anthropic_proxy,nv_build, ornv_inference) - Configure credentials through provider-specific environment variables (
OPENAI_API_KEY,ANTHROPIC_API_KEY,NV_BUILD_API_KEY, etc.) - Override models globally with
SKILLSPECTOR_MODELor per-slot withSKILLSPECTOR_SLOT_<name> - Instantiate provider classes directly to use multiple providers in a single SkillSpector run
Frequently Asked Questions
How does SkillSpector choose which LLM provider to use?
SkillSpector checks for environment variables in a fixed priority order defined in src/skillspector/llm_utils.py. It selects the first provider that finds valid credentials: OpenAI first, then Anthropic, Anthropic Proxy, NVIDIA Build, and finally NVIDIA Inference. You can override this by setting SKILLSPECTOR_PROVIDER to your preferred provider name.
Can I use different LLM providers for different analysis tasks?
Yes. While get_llm_provider() returns a single default provider, you can instantiate provider classes directly (e.g., OpenAIProvider(), AnthropicProvider()) and pass different instances to different nodes in your analysis graph. Each provider maintains its own credential configuration.
What is the difference between NVIDIA Build and NVIDIA Inference providers?
Both use the same credential variables (NV_BUILD_API_KEY and NV_BUILD_BASE_URL), but NvInferenceProvider serves as a fallback option when you want to explicitly switch to inference-specific endpoints. Set SKILLSPECTOR_PROVIDER=nv_inference to use this variant instead of the default NVIDIA Build provider.
How do I configure a custom model not in the default registry?
Set the SKILLSPECTOR_MODEL_REGISTRY environment variable to a YAML file path containing your custom model metadata. The registry loader in src/skillspector/providers/registry.py will parse this file to provide token-budget information and model specifications to your configured provider.
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 →