Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ENV=dev # options: dev|s

# Active LLM provider. Selects which provider answers credentials,
# metadata, and default-model lookups. Leave unset to default to nv_build.
# Options: openai | anthropic | anthropic_proxy | nv_build
# Options: openai | anthropic | anthropic_proxy | nv_build | gemini
SKILLSPECTOR_PROVIDER=

# Aggregate deadline for one complete scan workflow. Defaults to 600 seconds;
Expand Down Expand Up @@ -43,6 +43,15 @@ ANTHROPIC_PROXY_API_KEY=
# ANTHROPIC_PROXY_API_VERSION=vertex-2023-10-16 # optional; defaults to vertex-2023-10-16
# SKILLSPECTOR_SSL_VERIFY=false # set to false for internal/self-signed CAs

# For SKILLSPECTOR_PROVIDER=gemini (Google Cloud ADC / Workload Identity).
# Requires GOOGLE_CLOUD_PROJECT; GOOGLE_CLOUD_LOCATION defaults to global.
# Local use: gcloud auth application-default login (configure quota project with: gcloud auth application-default set-quota-project PROJECT_ID)
# Kubernetes/GKE: configure Workload Identity (leave GOOGLE_APPLICATION_CREDENTIALS unset)
# Note: regional endpoints alone do not guarantee data residency; global does not support residency.
GOOGLE_CLOUD_PROJECT=
# GOOGLE_CLOUD_LOCATION=global # optional; e.g. global, us, eu, us-central1
# GOOGLE_APPLICATION_CREDENTIALS= # optional; path to Workload/Workforce Identity Federation config JSON

# SkillSpector config
SKILLSPECTOR_MODEL= # leave empty to use the active provider's bundled default (see README); set to override (e.g. gpt-5.2)
# SKILLSPECTOR_MODEL_REGISTRY=./model_registry.yaml # optional override; defaults to each provider's bundled YAML in src/skillspector/providers/
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help install install-dev langgraph-dev test test-unit test-provider openai anthropic nv_build test-integration test-cov test-ci lint lint-fix format format-check clean build docker-build docker-smoke
.PHONY: help install install-dev langgraph-dev test test-unit test-provider openai anthropic nv_build gemini test-integration test-cov test-ci lint lint-fix format format-check clean build docker-build docker-smoke

# Prefer uv if available, else use pip (set when Makefile is parsed)
UV := $(shell command -v uv 2>/dev/null)
Expand All @@ -8,7 +8,7 @@ UV := $(shell command -v uv 2>/dev/null)
# make langgraph-dev LANGGRAPH_STUDIO_URL=https://your-studio.example
LANGGRAPH_STUDIO_URL = https://smith.langchain.com

PROVIDER_TEST_SELECTION := $(filter openai anthropic nv_build,$(MAKECMDGOALS))
PROVIDER_TEST_SELECTION := $(filter openai anthropic nv_build gemini,$(MAKECMDGOALS))
ifneq ($(PROVIDER_TEST_SELECTION),)
PROVIDER_TEST_PROVIDERS := $(PROVIDER_TEST_SELECTION)
PROVIDER_TEST_TARGETS :=
Expand All @@ -21,8 +21,11 @@ endif
ifneq ($(filter nv_build,$(PROVIDER_TEST_SELECTION)),)
PROVIDER_TEST_TARGETS += tests/provider/test_provider_endpoint.py::test_nv_build_provider_makes_live_structured_request
endif
ifneq ($(filter gemini,$(PROVIDER_TEST_SELECTION)),)
PROVIDER_TEST_TARGETS += tests/provider/test_provider_endpoint.py::test_gemini_provider_makes_live_structured_request
endif
else
PROVIDER_TEST_PROVIDERS := openai anthropic nv_build
PROVIDER_TEST_PROVIDERS := openai anthropic nv_build gemini
PROVIDER_TEST_TARGETS := tests/provider
endif

Expand All @@ -34,7 +37,7 @@ help:
@echo " make langgraph-dev - Run LangGraph dev server (Studio at \$$LANGGRAPH_STUDIO_URL)"
@echo " make test - Run unit + integration tests"
@echo " make test-unit - Run unit tests only (no LLM calls)"
@echo " make test-provider [openai|anthropic|nv_build] - Run live provider tests"
@echo " make test-provider [openai|anthropic|nv_build|gemini] - Run live provider tests"
@echo " make test-integration - Run integration tests only (invokes full graph, may call LLMs)"
@echo " make test-cov - Run tests with coverage report"
@echo " make lint - Run linters (ruff only)"
Expand Down Expand Up @@ -74,6 +77,7 @@ test-provider:
openai) env_name=OPENAI_API_KEY; label=OpenAI ;; \
anthropic) env_name=ANTHROPIC_API_KEY; label=Anthropic ;; \
nv_build) env_name=NVIDIA_INFERENCE_KEY; label="NV Build" ;; \
gemini) env_name=GOOGLE_CLOUD_PROJECT; label=Gemini ;; \
esac; \
eval "value=\$${$${env_name}:-}"; \
if [ -z "$$value" ]; then \
Expand All @@ -90,7 +94,7 @@ test-provider:
printf "missing provider keys\n" > "$$PROVIDER_TEST_MISSING_KEYS_FILE"; \
fi

openai anthropic nv_build:
openai anthropic nv_build gemini:
@:

# Run integration tests only (invokes full graph, may call LLMs)
Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ inference gateways.
| `anthropic_proxy` | `ANTHROPIC_PROXY_API_KEY` + `ANTHROPIC_PROXY_ENDPOINT_URL` | Any Vertex-style raw-predict proxy | `claude-sonnet-4-6` |
| `bedrock` | `AWS_PROFILE` (optional) + `AWS_REGION` — SigV4 via boto3 | AWS Bedrock Runtime | `us.anthropic.claude-sonnet-4-6-20250915-v1:0` |
| `nv_build` | `NVIDIA_INFERENCE_KEY` | build.nvidia.com | `deepseek-ai/deepseek-v4-flash` |
| `gemini` | `GOOGLE_CLOUD_PROJECT` (+ optional `GOOGLE_CLOUD_LOCATION`) via ADC | Google Cloud OpenAI-compatible Gemini endpoint | `gemini-3.8-flash` |
| `claude_cli` | _(none — uses local CLI auth)_ | local `claude` binary | local Claude runtime fallback, or `SKILLSPECTOR_MODEL` |
| `codex_cli` | _(none — uses local CLI auth)_ | local `codex` binary | local Codex runtime fallback, or `SKILLSPECTOR_MODEL` |

Expand Down Expand Up @@ -274,6 +275,31 @@ export SKILLSPECTOR_PROVIDER=nv_build
export NVIDIA_INFERENCE_KEY=nvapi-...
skillspector scan ./my-skill/

# Gemini on Google Cloud (Application Default Credentials / Workload Identity)
# Prerequisites:
# 1. Google Cloud project with billing enabled.
# 2. Enable Gemini Enterprise Agent Platform / Vertex AI API: `aiplatform.googleapis.com`.
# 3. IAM permission: grant `roles/aiplatform.user` (or at minimum `aiplatform.endpoints.predict`)
# to your user account or Kubernetes service account.
# 4. Local authentication: run `gcloud auth application-default login`.
# Configure a quota project if needed: `gcloud auth application-default set-quota-project PROJECT_ID`.
# 5. Kubernetes / GKE: configure Workload Identity and leave GOOGLE_APPLICATION_CREDENTIALS unset
# rather than exporting service account keys.
# Note on Data Residency:
# The default `global` endpoint does not support data-residency requirements. While you can target
# `us`, `eu`, or regional endpoints (e.g. `us-central1`), endpoint selection alone does not guarantee
# data residency or in-region processing without appropriate organizational policies. Always verify
# that your selected model is supported in your target location.
# Optional credentials:
# GOOGLE_APPLICATION_CREDENTIALS is optional and can reference Workload or Workforce Identity Federation
# configuration files; exporting long-lived service account keys is discouraged.
export SKILLSPECTOR_PROVIDER=gemini
export GOOGLE_CLOUD_PROJECT=my-project-id
# export GOOGLE_CLOUD_LOCATION=global # default is global; or us, eu, or specific region (e.g. us-central1)
# Default model: gemini-3.8-flash
# export SKILLSPECTOR_MODEL=gemini-3.7-flash
skillspector scan ./my-skill/

# Local Claude CLI — no API key; uses your existing `claude auth login` session
# Requires: claude CLI installed and authenticated (claude auth login)
export SKILLSPECTOR_PROVIDER=claude_cli
Expand Down Expand Up @@ -580,7 +606,10 @@ Issues (2)

| Variable | Description | Required |
|----------|-------------|----------|
| `SKILLSPECTOR_PROVIDER` | Active LLM provider: `openai`, `anthropic`, `anthropic_proxy`, `bedrock`, `nv_build`, `claude_cli`, `codex_cli`, or `gemini_cli`. Hosted providers use bundled `model_registry.yaml` defaults; `claude_cli` and `codex_cli` fall back to the local CLI runtime's default model unless `SKILLSPECTOR_MODEL` is set. Defaults to `nv_build`. | Optional |
| `SKILLSPECTOR_PROVIDER` | Active LLM provider: `openai`, `anthropic`, `anthropic_proxy`, `bedrock`, `nv_build`, `gemini`, `claude_cli`, `codex_cli`, or `gemini_cli`. Hosted providers use bundled `model_registry.yaml` defaults; `claude_cli` and `codex_cli` fall back to the local CLI runtime's default model unless `SKILLSPECTOR_MODEL` is set. Defaults to the NVIDIA path (`nv_inference`, falling back to `nv_build` in OSS builds). | Optional |
| `GOOGLE_CLOUD_PROJECT` | Google Cloud project ID for the `gemini` provider. Authenticates via Google Cloud Application Default Credentials (ADC) or GKE Workload Identity. | Required for LLM analysis when `SKILLSPECTOR_PROVIDER=gemini` |
| `GOOGLE_CLOUD_LOCATION` | Google Cloud location for the `gemini` provider endpoint (e.g. `global`, `us`, `eu`, `us-central1`). Defaults to `global`. | Optional (used when `SKILLSPECTOR_PROVIDER=gemini`) |
| `GOOGLE_APPLICATION_CREDENTIALS` | Optional path to ADC credential/config file (e.g. Workload or Workforce Identity Federation config; exported service account keys are discouraged). For local development, use `gcloud auth application-default login`; for GKE, use Workload Identity. | Optional (used when `SKILLSPECTOR_PROVIDER=gemini`) |
| `NVIDIA_INFERENCE_KEY` | Credential for the `nv_build` provider (build.nvidia.com). | Required for LLM analysis when `SKILLSPECTOR_PROVIDER=nv_build` |
| `OPENAI_API_KEY` | Credential for the OpenAI provider (`SKILLSPECTOR_PROVIDER=openai`). Also serves as the tier-2 fallback in the credential waterfall when the active provider returns no credentials. | Required for LLM analysis when `SKILLSPECTOR_PROVIDER=openai` |
| `OPENAI_BASE_URL` | Override the OpenAI endpoint (e.g. point at Ollama). | Optional |
Expand Down
6 changes: 6 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ and project URL.
- **Copyright:** Copyright (c) 2007-2022 The YARA Authors
- **URL:** https://github.com/VirusTotal/yara-python

### google-auth

- **License:** Apache-2.0
- **Copyright:** Copyright 2014 Google Inc.
- **URL:** https://github.com/googleapis/google-auth-library-python

---

## License Texts
Expand Down
2 changes: 2 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ The manual `test-provider` CI job and local `make test-provider` target perform
| `make test-provider openai` | `OPENAI_API_KEY` | `https://api.openai.com/v1` | `SKILLSPECTOR_OPENAI_TEST_MODEL` |
| `make test-provider anthropic` | `ANTHROPIC_API_KEY` | `https://api.anthropic.com` | `SKILLSPECTOR_ANTHROPIC_TEST_MODEL` |
| `make test-provider nv_build` | `NVIDIA_INFERENCE_KEY` | `https://integrate.api.nvidia.com/v1` | `SKILLSPECTOR_NV_BUILD_TEST_MODEL` |
| `make test-provider gemini` | `GOOGLE_CLOUD_PROJECT` | `https://aiplatform.googleapis.com/v1/...` | `SKILLSPECTOR_GEMINI_TEST_MODEL` |
| `make test-provider` | Any/all of the provider keys above | All provider default URLs above | Any/all provider model overrides above |

Base URL env vars are not needed for live provider tests; the tests intentionally use provider defaults.
Expand All @@ -332,6 +333,7 @@ Base URL env vars are not needed for live provider tests; the tests intentionall
- `nv_build/` — build.nvidia.com (HTTP, `NVIDIA_INFERENCE_KEY`)
- `openai/` — api.openai.com or any OpenAI-compatible URL (`OPENAI_API_KEY`)
- `anthropic/` — api.anthropic.com (`ANTHROPIC_API_KEY`)
- `gemini/` — Google Cloud OpenAI-compatible Gemini endpoint (`GOOGLE_CLOUD_PROJECT`, ADC / Workload Identity)
- `claude_cli/` — **local `claude` binary; no API key**. Uses the CLI's own auth session (`claude auth login`). Set `SKILLSPECTOR_PROVIDER=claude_cli`.
- `codex_cli/` — **local `codex` binary; no API key**. Uses the CLI's own auth session (`codex login`). Set `SKILLSPECTOR_PROVIDER=codex_cli`.

Expand Down
2 changes: 1 addition & 1 deletion docs/PI_EXTENSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Equivalent CLI:
- `format`: `terminal`, `json`, `markdown`, or `sarif`. Default: `terminal`.
- `output`: optional report path.
- `noLlm`: default `true`.
- `provider`: optional `openai`, `anthropic`, `anthropic_proxy`, or `nv_build`.
- `provider`: optional `openai`, `anthropic`, `anthropic_proxy`, `nv_build`, `nv_inference`, or `gemini`.
- `model`: optional model override.
- `yaraRulesDir`: optional directory of extra YARA rules.
- `verbose`: optional detailed progress.
Expand Down
2 changes: 1 addition & 1 deletion extensions/skillspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const scanSchema = Type.Object({
output: Type.Optional(Type.String({ description: "Optional report output path." })),
noLlm: Type.Optional(Type.Boolean({ description: "Skip LLM analysis. Defaults to true." })),
provider: Type.Optional(
StringEnum(["openai", "anthropic", "anthropic_proxy", "nv_build", "nv_inference"] as const, {
StringEnum(["openai", "anthropic", "anthropic_proxy", "nv_build", "nv_inference", "gemini"] as const, {
description: "Optional SkillSpector LLM provider when noLlm is false.",
}),
),
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies = [
"boto3>=1.34.0",
"langsmith>=0.7.30",
"yara-python>=4.5.0",
"google-auth[requests]>=2.53.0",
]

[project.optional-dependencies]
Expand Down
11 changes: 7 additions & 4 deletions src/skillspector/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,10 @@ def scan(
SKILLSPECTOR_PROVIDER Active LLM provider: openai | anthropic |
anthropic_proxy | bedrock | nv_build |
nv_inference | ollama | azure_openai |
openai_compatible | claude_cli | codex_cli |
gemini_cli. Defaults to the NVIDIA path
(nv_inference, falling back to nv_build in
OSS builds).
openai_compatible | gemini | claude_cli |
codex_cli | gemini_cli. Defaults to the
NVIDIA path (nv_inference, falling back to
nv_build in OSS builds).
SKILLSPECTOR_MODEL Override the active provider's default
model (applies to every analyzer slot).
SKILLSPECTOR_LOG_LEVEL DEBUG | INFO | WARNING | ERROR (default WARNING).
Expand All @@ -547,6 +547,9 @@ def scan(
AZURE_OPENAI_ENDPOINT for azure_openai
SKILLSPECTOR_COMPAT_API_KEY +
SKILLSPECTOR_COMPAT_BASE_URL for openai_compatible
GOOGLE_CLOUD_PROJECT [+ GOOGLE_CLOUD_LOCATION]
for gemini (uses Application
Default Credentials / Workload Identity)

ollama uses the local Ollama service. claude_cli, codex_cli, and
gemini_cli use their CLI's existing local authentication session.
Expand Down
1 change: 1 addition & 0 deletions src/skillspector/inference_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def provider_name(provider: object) -> str:
"ClaudeCLIProvider": "claude_cli",
"CodexCLIProvider": "codex_cli",
"GeminiCLIProvider": "gemini_cli",
"GeminiProvider": "gemini",
"NvBuildProvider": "nv_build",
"NvInferenceProvider": "nv_inference",
"OpenAIProvider": "openai",
Expand Down
22 changes: 16 additions & 6 deletions src/skillspector/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
ollama → OllamaProvider (local Ollama instance)
azure_openai → AzureOpenAIProvider (Azure OpenAI Service)
openai_compatible → OpenAICompatibleProvider (Groq, Together AI, Mistral, etc.)
gemini → GeminiProvider (Google Cloud ADC / Workload Identity)
claude_cli → ClaudeCLIProvider (local ``claude`` binary, no API key)
codex_cli → CodexCLIProvider (local ``codex`` binary, no API key)
gemini_cli → GeminiCLIProvider (local ``gemini`` binary, no API key)
Expand Down Expand Up @@ -133,6 +134,10 @@ def _select_active_provider() -> LLMProvider:
from .openai_compatible import OpenAICompatibleProvider

return OpenAICompatibleProvider()
if name == "gemini":
from .gemini import GeminiProvider

return GeminiProvider()
if name == "nv_build":
return NvBuildProvider()
if name == "claude_cli":
Expand Down Expand Up @@ -164,7 +169,7 @@ def _select_active_provider() -> LLMProvider:
raise ValueError(
f"Unknown SKILLSPECTOR_PROVIDER: {name!r}. "
"Expected one of: openai, anthropic, anthropic_proxy, bedrock, nv_build, "
"ollama, azure_openai, openai_compatible, "
"ollama, azure_openai, openai_compatible, gemini, "
"claude_cli, codex_cli, gemini_cli, antigravity_cli (or unset)."
)

Expand Down Expand Up @@ -216,20 +221,25 @@ def resolve_chat_model_credentials() -> tuple[str, str | None] | None:
def get_model_config_provider() -> ModelMetadataProvider:
"""Return the provider whose model defaults match graph chat-model routing.

Explicit bindings, CLI providers, and Bedrock's native AWS credential path
remain authoritative. Unbound API-key providers use OpenAI metadata only
when their own credentials are absent and the OpenAI fallback is configured.
Explicit bindings, CLI providers, Bedrock's native AWS credential path,
and Gemini's ADC path remain authoritative. Unbound API-key providers use
OpenAI metadata only when their own credentials are absent and the OpenAI
fallback is configured.
"""
provider = _select_active_provider()
from .bedrock import BedrockProvider
from .gemini import GeminiProvider

if (
has_provider_binding()
or has_cli_capability(provider)
or isinstance(provider, BedrockProvider)
or isinstance(provider, (BedrockProvider, GeminiProvider))
):
return provider
if provider.resolve_credentials() is not None:
try:
if provider.resolve_credentials() is not None:
return provider
except ValueError:
return provider

fallback = _openai_fallback_provider()
Expand Down
20 changes: 20 additions & 0 deletions src/skillspector/providers/gemini/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Gemini on Google Cloud provider package."""

from .provider import REGISTRY_PATH, GeminiProvider

__all__ = ["REGISTRY_PATH", "GeminiProvider"]
46 changes: 46 additions & 0 deletions src/skillspector/providers/gemini/model_registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Token-budget metadata for the GeminiProvider on Google Cloud.
# Bundled with the package; consulted whenever the active provider is GeminiProvider.
#
# Format:
# models:
# "<model-label>":
# context_length: <int> # total context window in tokens (required)
# max_output_tokens: <int> # model's max output cap (optional)
#

models:
"gemini-3.8-flash":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.7-flash":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.6-flash":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.5-flash-lite":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.5-flash":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.1-pro-preview":
context_length: 1000000
max_output_tokens: 64000

"gemini-3.1-flash-lite":
context_length: 1000000
max_output_tokens: 64000

"gemini-2.5-pro":
context_length: 1000000
max_output_tokens: 64000

"gemini-2.5-flash":
context_length: 1000000
max_output_tokens: 64000
Loading
Loading