# How to Configure Multiple LLM Providers in SkillSpector: A Complete Guide

> Easily configure multiple LLM providers in SkillSpector for OpenAI, Anthropic, and NVIDIA APIs. This guide shows you how to set them up via environment variables or direct instantiation for flexible analysis.

- Repository: [NVIDIA Corporation/SkillSpector](https://github.com/NVIDIA/SkillSpector)
- Tags: how-to-guide
- Published: 2026-06-25

---

**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`](https://github.com/NVIDIA/SkillSpector/blob/main/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 including `context_length` and `max_output_tokens` for specific model configurations.
- **`CredentialsProvider`** – Provides API authentication through environment variables and optional base URL overrides for custom endpoints.
- **`ChatModelProvider`** – Constructs LangChain `BaseChatModel` instances via the `create_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`](https://github.com/NVIDIA/SkillSpector/blob/main/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:

1. **`OpenAIProvider`** – Requires `OPENAI_API_KEY`
2. **`AnthropicProvider`** – Requires `ANTHROPIC_API_KEY`
3. **`AnthropicProxyProvider`** – Requires `ANTHROPIC_API_KEY` and `ANTHROPIC_BASE_URL` for Vertex-style endpoints
4. **`NvBuildProvider`** – Requires `NV_BUILD_API_KEY` and `NV_BUILD_BASE_URL`
5. **`NvInferenceProvider`** – 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:

```bash
openai | anthropic | anthropic_proxy | nv_build | nv_inference

```

Each provider requires specific environment variables:

- **OpenAI**: `OPENAI_API_KEY`
- **Anthropic**: `ANTHROPIC_API_KEY`, optional `ANTHROPIC_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:

1. **Global override** – Set `SKILLSPECTOR_MODEL` to apply across all analysis slots
2. **Slot-specific default** – Configure the `SLOT_DEFAULTS` dictionary for specific analysis components (e.g., `meta_analyzer`)
3. **Provider default** – Falls back to the provider's `DEFAULT_MODEL` constant (e.g., `OpenAIProvider.DEFAULT_MODEL`)

```bash

# 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:

```bash
export SKILLSPECTOR_MODEL_REGISTRY="/path/to/custom_models.yaml"

```

The registry loader in [`src/skillspector/providers/registry.py`](https://github.com/NVIDIA/SkillSpector/blob/main/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:

```python
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:

```python
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.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/base.py) with three core interfaces: `ModelMetadataProvider`, `CredentialsProvider`, and `ChatModelProvider`.
- **Automatic selection** checks for credentials in the order: OpenAI → Anthropic → Anthropic Proxy → NVIDIA Build → NVIDIA Inference.
- **Force a specific provider** by setting `SKILLSPECTOR_PROVIDER` to the desired provider key.
- **Model overrides** support global settings via `SKILLSPECTOR_MODEL`, slot-specific defaults through `SLOT_DEFAULTS`, or custom registries via `SKILLSPECTOR_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`](https://github.com/NVIDIA/SkillSpector/blob/main/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.