# has_provider_credentials

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/model_config/has_provider_credentials)

Check if credentials are available for a provider.

Combines two credential sources to decide whether a provider's API key
is present *before* attempting model creation:

1. **Config-file providers** (`config.toml` `[providers.<name>]`):
    - If the section declares `api_key_env`, that env var is checked
        via `resolve_env_var()` (which honors `DEEPAGENTS_CLI_` prefixes).

        Returns `True`/`False` accordingly.
    - If the section has `class_path` but no `api_key_env`, the provider is
        assumed to manage its own auth (e.g., custom headers, JWT, mTLS) and
        `True` is returned.
    - If neither `api_key_env` nor `class_path` is set, falls through
        to step 2.
2. **Hardcoded registry** (`PROVIDER_API_KEY_ENV`): a module-level dict
    mapping 18 well-known provider names to their canonical env var
    (e.g., `"anthropic"` → `"ANTHROPIC_API_KEY"`). The env var is checked
    via `resolve_env_var()`.
3. **Unknown providers** not present in either source: returns `None` so
    callers can decide whether to block or defer to the provider SDK's own
    auth handling.

## Signature

```python
has_provider_credentials(
    provider: str,
) -> bool | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `provider` | `str` | Yes | Provider name (e.g., `"anthropic"`, `"openai"`). |

## Returns

`bool | None`

`True` if credentials are confirmed available or the provider is
expected to manage its own auth (e.g., `class_path` providers).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/b710a69b12e49479045eaa54dfb709326473500b/libs/cli/deepagents_cli/model_config.py#L717)