# How to Configure Various LLM Providers Like OpenAI, Anthropic, and NVIDIA in SkillSpector

> Learn to configure LLM providers like OpenAI, Anthropic, and NVIDIA in SkillSpector using the SKILLSPECTOR_PROVIDER environment variable for seamless integration.

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

---

**SkillSpector abstracts LLM backends behind a unified provider interface that you configure using the `SKILLSPECTOR_PROVIDER` environment variable, with provider-specific credentials and optional model overrides.**

SkillSpector supports multiple large language model backends through a pluggable provider architecture. You can configure various LLM providers like OpenAI, Anthropic, and NVIDIA by setting environment variables that control provider selection, authentication, and model defaults. The system abstracts the underlying implementation details through the `skillspector.providers.base.LLMProvider` abstract base class, allowing seamless switching between backends without code changes.

## Provider Selection via Environment Variables

The active provider is determined at runtime by the **`SKILLSPECTOR_PROVIDER`** environment variable, which defaults to `nv_build` if unset. The selector function `_select_active_provider` in [`src/skillspector/providers/__init__.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/__init__.py) reads this variable once per process and caches the resulting provider instance.

### OpenAI Configuration

To use OpenAI as your backend, set the provider key and API credentials:

```bash
export SKILLSPECTOR_PROVIDER=openai
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
export OPENAI_BASE_URL=https://api.openai.com/v1  # Optional custom endpoint

```

The `OpenAIProvider` class in [`src/skillspector/providers/openai/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/openai/provider.py) implements credential resolution by reading `OPENAI_API_KEY` and optionally `OPENAI_BASE_URL`. The default model is `gpt-5.4`, though you can override this via `SKILLSPECTOR_MODEL`.

### Anthropic Configuration

For Anthropic's Claude models, configure the following:

```bash
export SKILLSPECTOR_PROVIDER=anthropic
export ANTHROPIC_API_KEY=your-anthropic-key

```

The `AnthropicProvider` in [`src/skillspector/providers/anthropic/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/anthropic/provider.py) uses `ANTHROPIC_API_KEY` as its credential source. Default models include `claude-opus-4-6` for standard slots and `claude-sonnet-4-6` for the `meta_analyzer` slot.

### NVIDIA Build Configuration

To use NVIDIA's build endpoint:

```bash
export SKILLSPECTOR_PROVIDER=nv_build
export NVIDIA_INFERENCE_KEY=nv-inference-key-123

```

The `NvBuildProvider` in [`src/skillspector/providers/nv_build/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/nv_build/provider.py) automatically targets `https://integrate.api.nvidia.com/v1` and defaults to `deepseek-ai/deepseek-v4-flash` for standard operations, switching to `deepseek-ai/deepseek-v4-pro` for meta-analysis tasks.

## Architecture and Implementation Details

### Provider Selection Logic

The provider selection mechanism lives in [`src/skillspector/providers/__init__.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/__init__.py). The `_select_active_provider` function returns an instance of the concrete provider class based on the `SKILLSPECTOR_PROVIDER` value. If the chosen provider cannot supply valid credentials, the system falls back to the standard OpenAI provider, preserving backward compatibility with existing `OPENAI_API_KEY` configurations.

Each concrete provider implements four core responsibilities defined in `skillspector.providers.base.LLMProvider`:

1. **Credential resolution** – Returns a `(api_key, base_url)` tuple from environment variables
2. **Chat model construction** – Creates native LangChain chat models via `skillspector.providers.chat_models.create_openai_compatible_chat_model`
3. **Token-budget metadata lookup** – Queries [`model_registry.yaml`](https://github.com/NVIDIA/SkillSpector/blob/main/model_registry.yaml) through `skillspector.providers.registry`
4. **Model resolution** – Determines model identifiers for specific slots

### Model Resolution and Slot Defaults

Providers define slot-specific defaults through the `SLOT_DEFAULTS` dictionary. For example, the `meta_analyzer` slot may map to a different model than the `default` slot. You can override slot defaults globally using the **`SKILLSPECTOR_MODEL`** environment variable:

```bash
export SKILLSPECTOR_MODEL=gpt-4o  # Forces this model across all slots

```

### Token Budget Metadata

The `skillspector.providers.registry` module provides `lookup_context_length` and `lookup_max_output_tokens` functions that query the bundled [`model_registry.yaml`](https://github.com/NVIDIA/SkillSpector/blob/main/model_registry.yaml). This allows SkillSpector to adapt token limits dynamically without hard-coding provider-specific constraints.

## Practical Configuration Examples

### Command-Line OpenAI Setup

Configure OpenAI with custom endpoints and model overrides for CLI usage:

```bash
export SKILLSPECTOR_PROVIDER=openai
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
export OPENAI_BASE_URL=https://my.openai.endpoint/v1
export SKILLSPECTOR_MODEL=gpt-4o
skillspector scan ./my-skill/ --format json

```

### Programmatic Anthropic Usage

Integrate Anthropic models in Python scripts:

```python
import os
from skillspector.providers import get_metadata_provider, create_chat_model

os.environ["SKILLSPECTOR_PROVIDER"] = "anthropic"
os.environ["ANTHROPIC_API_KEY"] = "my-anthropic-key"

provider = get_metadata_provider()
model_name = provider.resolve_model()  # Returns "claude-opus-4-6"

chat = create_chat_model(model_name, max_tokens=500)

response = chat.invoke({"content": "Explain the principle of least privilege."})
print(response.content)

```

### NVIDIA Build Endpoint Activation

Switch to NVIDIA's inference API:

```bash
export SKILLSPECTOR_PROVIDER=nv_build
export NVIDIA_INFERENCE_KEY=nv-inference-key-123
skillspector scan https://github.com/example/my-skill.git --no-llm

```

### Accessing Token Metadata

Query model constraints programmatically:

```python
from skillspector.providers.openai import OpenAIProvider
from skillspector.providers.registry import lookup_context_length

provider = OpenAIProvider()
model = provider.resolve_model()
context_len = lookup_context_length(provider.REGISTRY_PATH, model)
print(f"{model} supports up to {context_len} tokens of context.")

```

## Summary

- SkillSpector uses **`SKILLSPECTOR_PROVIDER`** to select between OpenAI, Anthropic, and NVIDIA backends, defaulting to `nv_build`
- Each provider requires specific environment variables: **`OPENAI_API_KEY`**, **`ANTHROPIC_API_KEY`**, or **`NVIDIA_INFERENCE_KEY`**
- The **`SKILLSPECTOR_MODEL`** variable overrides slot defaults for consistent model selection across analysis tasks
- Provider classes in `src/skillspector/providers/` implement the `LLMProvider` interface for credential resolution, chat model construction, and metadata lookup
- The system falls back to OpenAI if the selected provider lacks valid credentials, ensuring robust error handling

## Frequently Asked Questions

### How do I switch between OpenAI and Anthropic in SkillSpector?

Set the **`SKILLSPECTOR_PROVIDER`** environment variable to either `openai` or `anthropic` before running your command. Ensure you have exported the corresponding API key (`OPENAI_API_KEY` or `ANTHROPIC_API_KEY`). The change takes effect immediately for the next command, as the provider is selected at runtime and cached per process.

### What happens if I don't set the NVIDIA inference key when using nv_build?

If `NVIDIA_INFERENCE_KEY` is missing when `SKILLSPECTOR_PROVIDER=nv_build`, the system cannot authenticate with the NVIDIA endpoint. According to the fallback logic in [`src/skillspector/providers/__init__.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/__init__.py), SkillSpector will attempt to fall back to the OpenAI provider if `OPENAI_API_KEY` is available, preserving functionality but switching backends silently.

### Can I use a custom OpenAI-compatible endpoint instead of the official API?

Yes. When `SKILLSPECTOR_PROVIDER=openai`, set the **`OPENAI_BASE_URL`** environment variable to your custom endpoint (e.g., `https://my.openai.endpoint/v1`). The `OpenAIProvider` class passes this base URL to the underlying LangChain `ChatOpenAI` constructor via `skillspector.providers.chat_models.create_openai_compatible_chat_model`.

### Where does SkillSpector store default model configurations?

Default models and token limits are defined in the bundled [`model_registry.yaml`](https://github.com/NVIDIA/SkillSpector/blob/main/model_registry.yaml) file, accessed through the `skillspector.providers.registry` module. Each provider class defines `SLOT_DEFAULTS` dictionaries mapping analysis slots like `default` and `meta_analyzer` to specific model identifiers, allowing different models for different task types without manual configuration.