Official Doppel Python SDK
Project description
doppel-sdk — Python
Official Doppel SDK for Python. Wrap your existing LLM client and every call is captured and forwarded to Doppel — no change to your call sites.
Supports OpenAI, OpenRouter (and the OpenAI-compatible family: DeepSeek, Qwen, Grok, Mistral, …), Anthropic, and Google Gemini — across sync and async clients, and streaming and non-streaming calls. Zero runtime dependencies.
Install
pip install doppel-sdk
Usage
from doppel_sdk import DoppelClient
from openai import OpenAI
# Reads DOPPEL_API_KEY from the environment (or pass api_key=...).
doppel = DoppelClient(shadow_model="gpt-4o-mini")
client = doppel.wrap_openai(OpenAI())
client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
Other providers:
doppel.wrap_anthropic(Anthropic()) # messages.create
doppel.wrap_google(genai.Client()) # google-genai (or a GenerativeModel)
doppel.wrap_openrouter(OpenAI(base_url=".../openrouter"))
Async clients (AsyncOpenAI, AsyncAnthropic, client.aio.models) work the
same way — the interceptor detects and handles them automatically. Streaming
calls are captured too; for OpenAI/OpenRouter the SDK auto-enables
stream_options.include_usage so token usage is recorded.
In short-lived processes (serverless, CLI), flush pending deliveries before exit:
doppel.flush()
Configuration
| Setting | Argument | Environment variable | Default |
|---|---|---|---|
| API key | api_key |
DOPPEL_API_KEY |
— (required) |
| Server URL | server_url |
DOPPEL_SERVER_URL |
https://api.doppel.in |
| Shadow model | shadow_model |
— | none (chosen in the dashboard) |
| Debug logs | debug |
DOPPEL_DEBUG (1/true) |
off |
Development
pip install -e ".[dev]"
pytest
Publishing
Pushing a py-v* tag runs the tests, builds, and publishes to PyPI (trusted
publishing — no token):
# bump version in pyproject.toml first, then:
git tag py-v0.1.0
git push origin py-v0.1.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file doppel_sdk-0.2.0.tar.gz.
File metadata
- Download URL: doppel_sdk-0.2.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
565447f7120a8ad888d5429ffb123cbedf11f01c9732481fb5f3df8c867e7b92
|
|
| MD5 |
f1bec794a2ea69cb8404b95ed0281328
|
|
| BLAKE2b-256 |
a37bf761eb1824c045807c6bd32e85e63e4bde531ccd70203cd9083d42d07bac
|
Provenance
The following attestation bundles were made for doppel_sdk-0.2.0.tar.gz:
Publisher:
publish-python.yml on doppelimpacttest/doppel-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doppel_sdk-0.2.0.tar.gz -
Subject digest:
565447f7120a8ad888d5429ffb123cbedf11f01c9732481fb5f3df8c867e7b92 - Sigstore transparency entry: 1871406205
- Sigstore integration time:
-
Permalink:
doppelimpacttest/doppel-sdk@3881c6854c2c0659b519362bdc4030038f935d7a -
Branch / Tag:
refs/tags/py-v0.2.0 - Owner: https://github.com/doppelimpacttest
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@3881c6854c2c0659b519362bdc4030038f935d7a -
Trigger Event:
push
-
Statement type:
File details
Details for the file doppel_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: doppel_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466cb0231f9715a7298f67b61dde614198c30fe1dcfbc6bac6b605d0d87958c3
|
|
| MD5 |
92d1d75276040b088a33ef556e4e45fc
|
|
| BLAKE2b-256 |
8417e6440c7ccc970e32a25fbbe9b4302714b786637dff2c323304d1942a46c3
|
Provenance
The following attestation bundles were made for doppel_sdk-0.2.0-py3-none-any.whl:
Publisher:
publish-python.yml on doppelimpacttest/doppel-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doppel_sdk-0.2.0-py3-none-any.whl -
Subject digest:
466cb0231f9715a7298f67b61dde614198c30fe1dcfbc6bac6b605d0d87958c3 - Sigstore transparency entry: 1871406273
- Sigstore integration time:
-
Permalink:
doppelimpacttest/doppel-sdk@3881c6854c2c0659b519362bdc4030038f935d7a -
Branch / Tag:
refs/tags/py-v0.2.0 - Owner: https://github.com/doppelimpacttest
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@3881c6854c2c0659b519362bdc4030038f935d7a -
Trigger Event:
push
-
Statement type: