# How to Configure SkillSpector Provider Credentials for Anthropic, NVIDIA, and OpenAI

> Configure SkillSpector provider credentials for Anthropic, NVIDIA, and OpenAI using environment variables. Learn how to set API keys for seamless LLM integration.

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

---

**SkillSpector obtains LLM provider credentials exclusively from environment variables, using `SKILLSPECTOR_PROVIDER` to select between Anthropic, OpenAI, or NVIDIA, while requiring provider-specific API keys such as `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` to authenticate requests.**

NVIDIA's SkillSpector is an open-source codebase analysis tool that integrates with multiple large language model providers. To configure SkillSpector provider credentials, you must export environment variables that specify your chosen provider and supply the corresponding API authentication tokens.

## Supported LLM Providers and Required Credentials

SkillSpector supports three LLM providers, each requiring specific environment variables for authentication.

### Anthropic Configuration

The Anthropic provider requires the `ANTHROPIC_API_KEY` environment variable. This key authenticates requests to `api.anthropic.com`.

- **Required variable**: `ANTHROPIC_API_KEY`
- **Optional variables**: None (base URL is fixed)
- **Default models**: `claude-opus-4-6` for analysis tasks, `claude-sonnet-4-6` for the meta-analyzer

In [`src/skillspector/providers/anthropic/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/anthropic/provider.py), the credential resolution follows this pattern:

```python
api_key = os.environ.get("ANTHROPIC_API_KEY", "").strip()
if not api_key:
    return None

```

### OpenAI Configuration

The OpenAI provider accepts `OPENAI_API_KEY` for standard OpenAI endpoints, with optional support for custom base URLs via `OPENAI_BASE_URL`.

- **Required variable**: `OPENAI_API_KEY`
- **Optional variable**: `OPENAI_BASE_URL` (for Azure OpenAI or custom endpoints)
- **Default model**: `gpt-4-turbo-1106`

In [`src/skillspector/providers/openai/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/openai/provider.py), the implementation reads:

```python
api_key = os.environ.get("OPENAI_API_KEY", "").strip()
base_url = os.environ.get("OPENAI_BASE_URL")

```

### NVIDIA Configuration

The NVIDIA provider uses internal infrastructure credentials rather than standard API keys.

- **Required variable**: `NV_BUILD_API_KEY` (used internally)
- **Model source**: Loaded from [`model_registry.yaml`](https://github.com/NVIDIA/SkillSpector/blob/main/model_registry.yaml)
- **Note**: No explicit key configuration is required for standard usage

## Setting the Active Provider with SKILLSPECTOR_PROVIDER

Set `SKILLSPECTOR_PROVIDER` to specify which LLM backend to use. Valid values are `anthropic`, `openai`, or `nv_build`.

```bash
export SKILLSPECTOR_PROVIDER=anthropic

# or

export SKILLSPECTOR_PROVIDER=openai

# or

export SKILLSPECTOR_PROVIDER=nv_build

```

If the selected provider cannot locate its required API key, SkillSpector falls back to the next available provider in the order **Anthropic → OpenAI**, as implemented in [`src/skillspector/providers/__init__.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/__init__.py) and [`src/skillspector/llm_utils.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/llm_utils.py). If no valid credentials are found for any provider, the library raises `NO_LLM_API_KEY_MESSAGE`.

## Using a .env File vs Shell Environment Variables

You can configure credentials via shell exports or a `.env` file placed in the repository root. The CLI automatically loads variables from `.env` using python-dotenv.

**Shell configuration:**

```bash
export SKILLSPECTOR_PROVIDER=anthropic
export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx

```

**`.env` file configuration:**

```bash
SKILLSPECTOR_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxx
OPENAI_BASE_URL=https://my-azure-openai.openai.azure.com/

```

## How Credential Resolution Works in the Source Code

The credential resolution follows a specific hierarchy defined in the provider initialization code.

### Provider Resolution Logic

In [`src/skillspector/providers/__init__.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/__init__.py), the system implements fallback logic:

1. Check if `SKILLSPECTOR_PROVIDER` is set and valid
2. Attempt to load credentials for the specified provider
3. If credentials are missing, fall back to Anthropic, then OpenAI
4. Raise `NO_LLM_API_KEY_MESSAGE` if no credentials are found

### Anthropic Implementation

Located in [`src/skillspector/providers/anthropic/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/anthropic/provider.py), the code validates the API key before instantiating `ChatAnthropic`:

```python
api_key = os.environ.get("ANTHROPIC_API_KEY", "").strip()
if not api_key:
    return None

# Builds ChatAnthropic instance with validated key

```

### OpenAI Implementation

In [`src/skillspector/providers/openai/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/openai/provider.py), the provider handles both standard and custom endpoints:

```python
api_key = os.environ.get("OPENAI_API_KEY", "").strip()
base_url = os.environ.get("OPENAI_BASE_URL")
if not api_key:
    return None

# Uses base_url if provided, otherwise uses default OpenAI endpoint

```

## Complete Configuration Examples

### Configure SkillSpector with Anthropic

```python
import os
os.environ["SKILLSPECTOR_PROVIDER"] = "anthropic"
os.environ["ANTHROPIC_API_KEY"] = "sk-ant-xxxxxxxxxxxx"

from skillspector.cli import main
main()

```

### Configure SkillSpector with OpenAI and Azure

```python
import os
os.environ.update({
    "SKILLSPECTOR_PROVIDER": "openai",
    "OPENAI_API_KEY": "sk-xxxxxxxxxxxx",
    "OPENAI_BASE_URL": "https://my-azure-openai.openai.azure.com/",
})
from skillspector.cli import main
main()

```

### Programmatic Credential Resolution

```python
from skillspector.providers import resolve_provider_credentials

api_key, base_url = resolve_provider_credentials()
print(f"Using API key: {api_key[:6]}…")
print(f"Base URL: {base_url or 'default'}")

```

### Bash Setup for NVIDIA Provider

```bash
export SKILLSPECTOR_PROVIDER=nv_build
export NV_BUILD_API_KEY=your-internal-key

```

## Summary

- **SkillSpector provider credentials** are configured exclusively through environment variables, with no support for hardcoded configuration files.
- Set `SKILLSPECTOR_PROVIDER` to `anthropic`, `openai`, or `nv_build` to select your LLM backend.
- Provide `ANTHROPIC_API_KEY` for Anthropic, `OPENAI_API_KEY` (and optionally `OPENAI_BASE_URL`) for OpenAI, or `NV_BUILD_API_KEY` for NVIDIA.
- The system automatically falls back from Anthropic to OpenAI if the primary provider's credentials are missing.
- Place a `.env` file in the repository root for automatic loading, or export variables directly in your shell.

## Frequently Asked Questions

### Can I use Azure OpenAI with SkillSpector?

Yes. Set `SKILLSPECTOR_PROVIDER=openai` and export both `OPENAI_API_KEY` and `OPENAI_BASE_URL` pointing to your Azure endpoint. In [`src/skillspector/providers/openai/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/openai/provider.py), the code reads `OPENAI_BASE_URL` and passes it to the underlying client, enabling compatibility with Azure OpenAI Service deployments.

### What happens if I don't set SKILLSPECTOR_PROVIDER?

If `SKILLSPECTOR_PROVIDER` is not set, or if the specified provider lacks valid credentials, SkillSpector attempts to resolve available providers in the fallback order **Anthropic → OpenAI**. According to [`src/skillspector/llm_utils.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/llm_utils.py), the system checks for `ANTHROPIC_API_KEY` first, then `OPENAI_API_KEY`. If neither exists, it raises `NO_LLM_API_KEY_MESSAGE`.

### Why does SkillSpector use different default models for Anthropic?

Anthropic uses `claude-opus-4-6` for analysis tasks and `claude-sonnet-4-6` for the meta-analyzer, as defined in the provider configuration. OpenAI defaults to `gpt-4-turbo-1106` for all operations. These defaults are baked into the respective provider classes in [`src/skillspector/providers/anthropic/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/anthropic/provider.py) and [`src/skillspector/providers/openai/provider.py`](https://github.com/NVIDIA/SkillSpector/blob/main/src/skillspector/providers/openai/provider.py).

### How do I verify my credentials are loaded correctly?

You can programmatically verify credential resolution using the internal utility:

```python
from skillspector.providers import resolve_provider_credentials
api_key, base_url = resolve_provider_credentials()

```

If `api_key` returns `None` or raises an exception, your environment variables are not set correctly. Ensure your `.env` file is in the repository root or that variables are exported in your current shell session before importing SkillSpector modules.