Python SDK for Pendra — UK-based, privacy-first LLM inference
Project description
pendra-python
Official Python SDK for Pendra — UK-based, privacy-first LLM inference.
Your data is processed in the UK, never stored, never shared with US cloud providers.
Installation
pip install pendra
Quick Start
import pendra
client = pendra.Pendra(
api_key="pdr_sk_...", # or set PENDRA_API_KEY env var
)
response = client.chat.completions.create(
model="llama3.2",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of the UK?"},
],
)
print(response.choices[0].message.content)
# → London is the capital of the United Kingdom.
Streaming
with client.chat.completions.create(
model="llama3.2",
messages=[{"role": "user", "content": "Write me a short poem about London."}],
stream=True,
) as stream:
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
Async
import asyncio
import pendra
async def main():
async with pendra.AsyncPendra(api_key="pdr_sk_...") as client:
# Non-streaming
response = await client.chat.completions.create(
model="llama3.2",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
# Streaming
stream = await client.chat.completions.create(
model="llama3.2",
messages=[{"role": "user", "content": "Count to 5"}],
stream=True,
)
async for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
asyncio.run(main())
List Models
models = client.models.list()
for model in models:
print(model.id)
Environment Variables
| Variable | Description |
|---|---|
PENDRA_API_KEY |
Your Pendra API key (pdr_sk_...) |
OpenAI Compatibility
The Pendra SDK is fully compatible with the OpenAI Python SDK interface. To migrate:
# Before
from openai import OpenAI
client = OpenAI(api_key="sk-...")
# After
from pendra import Pendra
client = Pendra(api_key="pdr_sk_...")
The client.chat.completions.create() interface is identical.
Self-Hosted Workers
Run inference on your own GPUs with a single command. Your prompts and completions never leave your infrastructure.
curl -fsSL https://get.pendra.ai/worker | bash
See the Workers documentation for full setup instructions.
Licence
Apache-2.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 pendra-0.1.3.tar.gz.
File metadata
- Download URL: pendra-0.1.3.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a62d4a7cad5cadfab49cb9edc9e834dfce84074fcfd9780604fcecc25f5b0a
|
|
| MD5 |
939d61eb3489215830033a04176c03f7
|
|
| BLAKE2b-256 |
fe28f062bc49c1fecd5855d36bce91889464e4d402b8afa602765e1a130f69f0
|
Provenance
The following attestation bundles were made for pendra-0.1.3.tar.gz:
Publisher:
publish-sdk-python.yml on Pendra-Cloud/pendra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pendra-0.1.3.tar.gz -
Subject digest:
a7a62d4a7cad5cadfab49cb9edc9e834dfce84074fcfd9780604fcecc25f5b0a - Sigstore transparency entry: 1205641409
- Sigstore integration time:
-
Permalink:
Pendra-Cloud/pendra@9b55ff8d57c8835404c642d09205edce488a5914 -
Branch / Tag:
refs/tags/sdk-python-v0.1.3 - Owner: https://github.com/Pendra-Cloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@9b55ff8d57c8835404c642d09205edce488a5914 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pendra-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pendra-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecc2ebd8cedf2352ce94b01c9c57c3b60f56f9726d0b66aee21a505a92222962
|
|
| MD5 |
9eaa2dd7f4c1564ec3b302abd9b118c2
|
|
| BLAKE2b-256 |
6984f47553149b1af7223f1a91432939c210cd1596b70cf7a09abe84b7dfa86e
|
Provenance
The following attestation bundles were made for pendra-0.1.3-py3-none-any.whl:
Publisher:
publish-sdk-python.yml on Pendra-Cloud/pendra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pendra-0.1.3-py3-none-any.whl -
Subject digest:
ecc2ebd8cedf2352ce94b01c9c57c3b60f56f9726d0b66aee21a505a92222962 - Sigstore transparency entry: 1205641410
- Sigstore integration time:
-
Permalink:
Pendra-Cloud/pendra@9b55ff8d57c8835404c642d09205edce488a5914 -
Branch / Tag:
refs/tags/sdk-python-v0.1.3 - Owner: https://github.com/Pendra-Cloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@9b55ff8d57c8835404c642d09205edce488a5914 -
Trigger Event:
push
-
Statement type: