piatra-ai
Thin wrapper over the official openai SDK,
preset for the Piatra AI Gateway. It does exactly three
things: presets the gateway base URL, reads the key from PIATRA_AI_KEY, and
exposes typed piatra.* model-id constants. Everything else — chat, streaming,
retries — is the OpenAI SDK's, unchanged.
Install
pip install piatra-ai
Imported as piatra_ai.
Usage
from piatra_ai import PiatraAI, MODELS
client = PiatraAI()
# api_key defaults to os.environ["PIATRA_AI_KEY"]
# base_url defaults to https://ai.piatra.center/v1
res = client.chat.completions.create(
model=MODELS.GLM, # "piatra.glm"
messages=[{"role": "user", "content": "What is default logic?"}],
)
Streaming and multimodal input are the OpenAI SDK's, unchanged:
stream = client.chat.completions.create(
model=MODELS.GLM, messages=messages, stream=True,
)
for chunk in stream:
...
client.chat.completions.create(
model=MODELS.MEDGEMMA, # the vision-capable model
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "describe this radiograph"},
{"type": "image_url", "image_url": {"url": data_url}},
],
}],
)
Configuration
| Argument | Default | Notes |
|---|---|---|
api_key |
os.environ["PIATRA_AI_KEY"] |
The pi_live_* key, issued and owned by core. |
base_url |
https://ai.piatra.center/v1 |
Or set PIATRA_AI_BASE_URL. |
Any other OpenAI client keyword argument is accepted and passed through unchanged.
Release files for piatra-ai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| piatra_ai-0.2.0.tar.gz | 28.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| piatra_ai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / piatra_ai-0.2.0.tar.gz
| Download URL | piatra_ai-0.2.0.tar.gz |
|---|---|
| Size | 28.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4df4e76672f407fa4a68be5ad31afb390df877f80bf84360fb95bc93490a6ab
|
|
BLAKE2b-256 checksum How to use checksums |
aece935c61ba2010b25fe9179e098961ccaed8dd86d787bd010b60dbca2c88b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / piatra_ai-0.2.0-py3-none-any.whl
| Download URL | piatra_ai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e257cf627e30f81c6d8e948e7fe1ce0a4d5a8b268bb59495f9dba9c02a7ab0e
|
|
BLAKE2b-256 checksum How to use checksums |
226fa126e7aa9f5aeb24f1b36910edba55978a48417c51e4cc1870a6e68fd955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|