Dhenara AI
Dhenara AI is an open source Python package for calling multiple LLM providers through one typed interface. It keeps the integration surface small: provider credentials, model selection, prompt/message formatting, streaming, tool use, and structured output all flow through the same core client types.
For full documentation, visit docs.dhenara.com.
Installation
pip install dhenara-ai
Credential Setup
Dhenara AI discovers credentials in one of two ways:
- Pass an explicit file path to
ResourceConfig.load_from_file(). - Set
DAI_SECRET_CONFIG_DIRand placedai_credentials.yamlinside that directory.
If DAI_SECRET_CONFIG_DIR is unset, the default location is /run/secrets/dai/dai_credentials.yaml.
Use the checked-in template at src/dhenara/ai/types/resource/credentials.yaml as the starting point.
mkdir -p /path/to/secrets
export DAI_SECRET_CONFIG_DIR=/path/to/secrets
cp src/dhenara/ai/types/resource/credentials.yaml "$DAI_SECRET_CONFIG_DIR/dai_credentials.yaml"
Then edit dai_credentials.yaml and keep only the providers you actually use.
Quickstart
from dhenara.ai import AIModelClient
from dhenara.ai.types import AIModelAPIProviderEnum, AIModelCallConfig, ResourceConfig
resource_config = ResourceConfig()
resource_config.load_from_file(credentials_file=None, init_endpoints=True)
endpoint = resource_config.get_model_endpoint(
model_name="claude-haiku-4-5",
api_provider=AIModelAPIProviderEnum.ANTHROPIC,
)
if endpoint is None:
raise RuntimeError("No Anthropic endpoint configured for claude-haiku-4-5")
client = AIModelClient(
model_endpoint=endpoint,
config=AIModelCallConfig(
max_output_tokens=1024,
reasoning=False,
streaming=False,
),
is_async=False,
)
response = client.generate(
prompt="Explain quantum computing in simple terms.",
instructions=["Keep the answer under 120 words."],
)
if response.chat_response:
print(response.chat_response.text())
Running The Included Examples
The example programs use the same credential-loading contract. With a secret directory configured, you can run them directly:
export DAI_SECRET_CONFIG_DIR=/path/to/secrets
python examples/14_multi_turn_with_messages_api.py
If you prefer an explicit credentials file, pass that path where the example calls load_from_file().
Provider SDK Surfaces
- OpenAI direct and Azure OpenAI / Microsoft Foundry OpenAI v1 use the
openaiSDK. - Google Gemini Developer API and Gemini on Vertex AI use the
google-genaiSDK. - Anthropic direct, Amazon Bedrock, and Anthropic on Vertex use the
anthropicSDK. - Amazon Bedrock configuration stays under the
amazon_bedrockprovider block. The package passes those credentials intoAnthropicBedrock; there is no separate boto client setup in your application code. microsoft_azure_aiis not a supported text-generation surface indhenara-ai; usemicrosoft_openaiwith an Azure OpenAI or Microsoft Foundry OpenAI v1 endpoint instead.- For Microsoft-hosted OpenAI-compatible deployments, the
modelvalue in requests must be the Azure deployment name, not just the underlying vendor model family.
Metadata
Release files for dhenara-ai 1.1.6
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 |
|---|---|---|---|---|
| dhenara_ai-1.1.6.tar.gz | 125.9 kB | Without provenance | Details for dhenara_ai-1.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dhenara_ai-1.1.6-py3-none-any.whl | Python 3 | none | any | Details for dhenara_ai-1.1.6-py3-none-any.whl |
Total release size: 296.7 kB
Release files / dhenara_ai-1.1.6.tar.gz
| Download URL | dhenara_ai-1.1.6.tar.gz |
|---|---|
| Size | 125.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
629220d13edae0b36305ef5ced72e9c952c7a41592696eabd25e35c6102458aa
|
|
BLAKE2b-256 checksum How to use checksums |
f20cfcdfd9f5ff467e7f09e7284d6b51d83ab19d01dbb81d7a6b819e95b08bb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Release files / dhenara_ai-1.1.6-py3-none-any.whl
| Download URL | dhenara_ai-1.1.6-py3-none-any.whl |
|---|---|
| Size | 170.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb69262da9338539397240df33ff07ba5cb0f5b09c1775eb51c65fbd34ae7f02
|
|
BLAKE2b-256 checksum How to use checksums |
3533ce695e955e3d919e715c5847ca85abdebd9ee6ed720b90a42ffe79ba83f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Security for dhenara-ai 1.1.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.