How to Configure Different LLM Providers (OpenAI, Anthropic, NVIDIA) in SkillSpector

Set the SKILLSPECTOR_PROVIDER environment variable to openai, anthropic, or nv_build, then provide the corresponding API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, or NVIDIA_INFERENCE_KEY) to switch LLM backends without modifying code.

SkillSpector abstracts LLM access behind a provider plugin system that standardizes credential resolution and model metadata. To configure different LLM providers like OpenAI, Anthropic, or NVIDIA in SkillSpector, you manipulate environment variables that drive the selection logic in src/skillspector/providers/__init__.py. This architecture allows the static analysis engine to route inference requests to any supported backend while enforcing token budgets defined in per-provider registries.

Provider Selection Architecture

SkillSpector selects the active provider at runtime based on the SKILLSPECTOR_PROVIDER environment variable. The selection logic lives in src/skillspector/providers/__init__.py inside the _select_active_provider() function, which instantiates the appropriate provider class based on the variable's value.


# src/skillspector/providers/__init__.py

def _select_active_provider() -> ModelMetadataProvider:
    name = os.environ.get("SKILLSPECTOR_PROVIDER", "").strip().lower()
    if name == "openai":
        from .openai import OpenAIProvider
        return OpenAIProvider()
    if name == "anthropic":
        from .anthropic import AnthropicProvider
        return AnthropicProvider()
    if name == "nv_build":
        return NvBuildProvider()
    # fallback to nv_build when the optional nv_inference package is absent

    if name in ("nv_inference", ""):
        try:
            from .nv_inference import NvInferenceProvider
            return NvInferenceProvider()
        except ImportError:
            return NvBuildProvider()
    raise ValueError(...)

If SKILLSPECTOR_PROVIDER is unset or empty, SkillSpector defaults to the NVIDIA build-time provider (nv_build). The system also attempts to load the nv_inference provider if available, falling back to nv_build when the optional package is missing.

Core Provider Interfaces

Every provider implements two standardized interfaces:

  • CredentialsProvider (via resolve_credentials): Returns a tuple (api_key, base_url) or None if required environment variables are missing.
  • ModelMetadataProvider (via get_context_length, get_max_output_tokens, resolve_model): Looks up model-specific limits from a bundled model_registry.yaml and supplies per-slot default model names.

Configuring OpenAI

To route requests to OpenAI, set the provider identifier and API credentials. The OpenAIProvider class in src/skillspector/providers/openai/provider.py resolves credentials from standard OpenAI environment variables.


# src/skillspector/providers/openai/provider.py

class OpenAIProvider:
    DEFAULT_MODEL = "gpt-5.4"
    SLOT_DEFAULTS: dict[str, str] = {}

    def resolve_credentials(self) -> tuple[str, str | None] | None:
        api_key = os.environ.get("OPENAI_API_KEY", "").strip()
        if not api_key:
            return None
        base_url = os.environ.get("OPENAI_BASE_URL", "").strip() or None
        return api_key, base_url

Required configuration:

  1. Set SKILLSPECTOR_PROVIDER=openai
  2. Export OPENAI_API_KEY with your API key
  3. Optionally set OPENAI_BASE_URL to override the default https://api.openai.com/v1
export SKILLSPECTOR_PROVIDER=openai
export OPENAI_API_KEY=sk-your-openai-key
export OPENAI_BASE_URL=https://api.openai.com/v1  # Optional

skillspector scan path/to/skill

Configuring Anthropic

The Anthropic provider requires the ANTHROPIC_API_KEY environment variable and defaults to the Claude model family. Unlike OpenAI, this provider defines slot-specific defaults, routing the meta_analyzer slot to a different model than the default.

Configuration Value
Default Model claude-opus-4-6
Meta Analyzer Slot claude-sonnet-4-6
Base URL https://api.anthropic.com/v1/

Required configuration:

export SKILLSPECTOR_PROVIDER=anthropic
export ANTHROPIC_API_KEY=sk-your-anthropic-key

skillspector analyze path/to/skill

Configuring NVIDIA

SkillSpector defaults to the NVIDIA build provider (nv_build) when no provider is specified. This provider targets the NVIDIA inference endpoint and requires the NVIDIA_INFERENCE_KEY environment variable.

Configuration Value
Default Model deepseek-ai/deepseek-v4-flash
Meta Analyzer Slot deepseek-ai/deepseek-v4-pro
Base URL https://integrate.api.nvidia.com/v1

Required configuration:

export NVIDIA_INFERENCE_KEY=sk-your-nvidia-key

# SKILLSPECTOR_PROVIDER defaults to nv_build, so it can be omitted

skillspector run path/to/skill

If you have the optional nv_inference package installed, you can explicitly set SKILLSPECTOR_PROVIDER=nv_inference to use that implementation instead of the build provider.

Runtime Credential Resolution

After selection, the active provider supplies credentials to the LLM utility layer. The src/skillspector/llm_utils.py module delegates credential resolution to the provider system before falling back to raw environment variables.


# src/skillspector/llm_utils.py

def _resolve_llm_credentials() -> tuple[str, str | None]:
    creds = resolve_provider_credentials()   # ← from providers/__init__.py

    if creds is not None:
        return creds
    # fall back to raw OpenAI env vars

    resolved_key = os.environ.get("OPENAI_API_KEY", "").strip()
    ...

The resolved (api_key, base_url) tuple is passed to langchain_openai.ChatOpenAI, which SkillSpector uses for all LLM-based analyses regardless of the underlying provider.

Advanced Model Configuration

Overriding Default Models

Set SKILLSPECTOR_MODEL to override the provider's default model for the current session. This variable accepts either a model name that matches the default slot or a slot-specific identifier.


# Use a specific OpenAI model

export SKILLSPECTOR_PROVIDER=openai
export SKILLSPECTOR_MODEL=gpt-5.4-turbo

# Use a specific Anthropic model for meta-analysis

export SKILLSPECTOR_PROVIDER=anthropic
export SKILLSPECTOR_MODEL=claude-sonnet-4-6

Custom Model Registries

Each provider references a model_registry.yaml file that stores context_length and max_output_tokens for supported models. To use custom model definitions or enterprise-specific token limits, point to your own registry:

export SKILLSPECTOR_MODEL_REGISTRY=/path/to/custom/models.yaml

The registry utilities in src/skillspector/providers/registry.py load and cache this metadata, ensuring token budgets are enforced regardless of which provider is active.

Summary

  • Provider selection is controlled by the SKILLSPECTOR_PROVIDER environment variable (openai, anthropic, nv_build, or nv_inference), with nv_build as the default.
  • Credential resolution happens through provider-specific implementations of resolve_credentials() that read environment variables like OPENAI_API_KEY, ANTHROPIC_API_KEY, or NVIDIA_INFERENCE_KEY.
  • Model metadata (context length and output limits) is loaded from per-provider model_registry.yaml files via the ModelMetadataProvider interface.
  • Runtime integration occurs in src/skillspector/llm_utils.py, which passes resolved credentials to the LangChain client.
  • Customization is possible via SKILLSPECTOR_MODEL for model overrides and SKILLSPECTOR_MODEL_REGISTRY for custom token budgets.

Frequently Asked Questions

What is the default LLM provider in SkillSpector?

When SKILLSPECTOR_PROVIDER is unset, SkillSpector defaults to the NVIDIA build provider (nv_build). The selection logic in src/skillspector/providers/__init__.py attempts to import the optional NvInferenceProvider first, then falls back to NvBuildProvider if the package is unavailable.

Can I use a custom OpenAI-compatible endpoint with SkillSpector?

Yes. When using the OpenAI provider, set the OPENAI_BASE_URL environment variable to your custom endpoint URL. The OpenAIProvider.resolve_credentials() method checks for this variable and passes it to the LangChain client, allowing you to use OpenAI-compatible APIs from other vendors or self-hosted inference servers.

How do I configure different models for different analysis slots?

SkillSpector supports slot-specific model defaults through the provider's SLOT_DEFAULTS dictionary (e.g., meta_analyzer uses claude-sonnet-4-6 in the Anthropic provider). To override these at runtime, set SKILLSPECTOR_MODEL to the desired model name. The provider's resolve_model() method selects the appropriate model based on the active slot and environment configuration.

Why does SkillSpector require different environment variables for each provider?

Each provider implements the CredentialsProvider interface with its own resolve_credentials() method that checks for vendor-specific secrets. This design isolates authentication concerns: OpenAI checks OPENAI_API_KEY, Anthropic checks ANTHROPIC_API_KEY, and NVIDIA checks NVIDIA_INFERENCE_KEY. This prevents credential leakage between providers and allows you to keep multiple provider credentials in your environment simultaneously without conflict.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →