kiarina-lib-anthropic
English | 日本語
Dependencies
| Package | Version | License |
|---|---|---|
| Pydantic Settings | >=2.10.1 |
MIT |
| pydantic-settings-manager | >=3.2.0 |
MIT |
The Anthropic Python SDK is not included as a dependency. Add it to the application that creates the client.
Installation
pip install kiarina-lib-anthropic
Features
- Configuring an Anthropic Client Store an API key and optional base URL as typed settings.
- Managing Multiple Configurations Switch between named settings for multiple projects or environments.
- Loading Environment Variables
Load environment variables with the
KIARINA_LIB_ANTHROPIC_prefix. - Protecting API Keys
Store the API key as
SecretStrto prevent exposure in normal string representations.
Configuring an Anthropic Client
Convert AnthropicSettings into arguments for an Anthropic SDK client.
from anthropic import Anthropic
from kiarina.lib.anthropic import AnthropicSettings
settings = AnthropicSettings(api_key="sk-ant-...")
client = Anthropic(
api_key=(
settings.api_key.get_secret_value()
if settings.api_key is not None
else None
),
base_url=settings.base_url,
)
Both api_key and base_url are optional. When omitted, behavior is determined by the client that receives the settings.
Managing Multiple Configurations
settings_manager uses multiple-settings mode. Place named settings under configs.
kiarina.lib.anthropic:
default: production
configs:
development:
api_key: sk-ant-development
production:
api_key: sk-ant-production
import yaml
from pydantic_settings_manager import load_user_configs
from kiarina.lib.anthropic import settings_manager
with open("config.yaml", encoding="utf-8") as file:
load_user_configs(yaml.safe_load(file) or {})
settings = settings_manager.get_settings("production")
To configure only this package directly, assign settings_manager.user_config.
from kiarina.lib.anthropic import settings_manager
settings_manager.user_config = {
"default": "development",
"configs": {
"development": {"api_key": "sk-ant-development"},
"production": {"api_key": "sk-ant-production"},
},
}
Loading Environment Variables
Load a single configuration from environment variables.
export KIARINA_LIB_ANTHROPIC_API_KEY="sk-ant-..."
export KIARINA_LIB_ANTHROPIC_BASE_URL="https://api.anthropic.com"
from kiarina.lib.anthropic import AnthropicSettings
settings = AnthropicSettings()
Protecting API Keys
api_key is a SecretStr. Extract its value explicitly only where required.
api_key = (
settings.api_key.get_secret_value()
if settings.api_key is not None
else None
)
API Reference
kiarina.lib.anthropic
from kiarina.lib.anthropic import (
AnthropicSettings,
settings_manager,
)
AnthropicSettings
class AnthropicSettings(BaseSettings):
def __init__(
self,
*,
api_key: SecretStr | None = None,
base_url: str | None = None,
) -> None: ...
Anthropic client settings.
Fields
api_key(SecretStr | None): Anthropic API key.base_url(str | None): Base URL for the Anthropic API.
settings_manager
settings_manager: SettingsManager[AnthropicSettings]
Global instance that manages named Anthropic client settings.
Metadata
Release files for kiarina-lib-anthropic 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kiarina_lib_anthropic-2.3.1.tar.gz | 5.5 kB | With provenance | Details for kiarina_lib_anthropic-2.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kiarina_lib_anthropic-2.3.1-py3-none-any.whl | Python 3 | none | any | Details for kiarina_lib_anthropic-2.3.1-py3-none-any.whl |
Total release size: 9.5 kB
Release files / kiarina_lib_anthropic-2.3.1.tar.gz
| Download URL | kiarina_lib_anthropic-2.3.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e0fe1de2d4834e1b40cd862c1949fa6ee747016fc13918e5c43a74b1fa6588a
|
|
BLAKE2b-256 checksum How to use checksums |
998e3278ed0656282667e2208802c3b08cee078ffa00ff0174cf498047bafc76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.
Transparency logRelease files / kiarina_lib_anthropic-2.3.1-py3-none-any.whl
| Download URL | kiarina_lib_anthropic-2.3.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36d31e88441bbfecfebf5e167d941ddca267c51170fcd03937f2bca268c585fc
|
|
BLAKE2b-256 checksum How to use checksums |
720e62b4a90b16609a7749badb51cab676c86aa3fa47de8c056e39d8eeb8fc92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.
Transparency logSecurity for kiarina-lib-anthropic 2.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for kiarina_lib_anthropic-2.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.