diff --git a/docs/docs/providers/inference/remote_nvidia.mdx b/docs/docs/providers/inference/remote_nvidia.mdx index 657dcf3bc..b4e04176c 100644 --- a/docs/docs/providers/inference/remote_nvidia.mdx +++ b/docs/docs/providers/inference/remote_nvidia.mdx @@ -16,7 +16,7 @@ NVIDIA inference provider for accessing NVIDIA NIM models and AI services. |-------|------|----------|---------|-------------| | `allowed_models` | `list[str \| None` | No | | List of models that should be registered with the model registry. If None, all models are allowed. | | `refresh_models` | `` | No | False | Whether to refresh models periodically from the provider | -| `api_key` | `pydantic.types.SecretStr \| None` | No | | The NVIDIA API key, only needed of using the hosted service | +| `api_key` | `pydantic.types.SecretStr \| None` | No | | Authentication credential for the provider | | `url` | `` | No | https://integrate.api.nvidia.com | A base url for accessing the NVIDIA NIM | | `timeout` | `` | No | 60 | Timeout for the HTTP requests | | `append_api_version` | `` | No | True | When set to false, the API version will not be appended to the base_url. By default, it is true. | diff --git a/src/llama_stack/providers/remote/inference/nvidia/config.py b/src/llama_stack/providers/remote/inference/nvidia/config.py index b67c9e7a0..3545d2b11 100644 --- a/src/llama_stack/providers/remote/inference/nvidia/config.py +++ b/src/llama_stack/providers/remote/inference/nvidia/config.py @@ -7,7 +7,7 @@ import os from typing import Any -from pydantic import BaseModel, Field, SecretStr, field_validator +from pydantic import BaseModel, Field from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig from llama_stack.schema_utils import json_schema_type @@ -47,10 +47,6 @@ class NVIDIAConfig(RemoteInferenceProviderConfig): default_factory=lambda: os.getenv("NVIDIA_BASE_URL", "https://integrate.api.nvidia.com"), description="A base url for accessing the NVIDIA NIM", ) - api_key: SecretStr | None = Field( - default=None, - description="The NVIDIA API key, only needed of using the hosted service", - ) timeout: int = Field( default=60, description="Timeout for the HTTP requests", @@ -60,22 +56,6 @@ class NVIDIAConfig(RemoteInferenceProviderConfig): description="When set to false, the API version will not be appended to the base_url. By default, it is true.", ) - @field_validator("api_key", mode="before") - @classmethod - def _default_api_key_from_env(cls, value: SecretStr | str | None) -> SecretStr | None: - """Populate the API key from the NVIDIA_API_KEY environment variable when absent.""" - if value is None: - env_value = os.getenv("NVIDIA_API_KEY") - return SecretStr(env_value) if env_value else None - - if isinstance(value, SecretStr): - return value - - if isinstance(value, str): - return SecretStr(value) - - return value - @classmethod def sample_run_config( cls,