Official Python SDK for asertu optimizer AI observability.
Project description
asertu Optimizer Python SDK
SDK oficial de Python para asertu Optimizer, el producto de observabilidad, coste y optimizacion del uso de IA de la plataforma general asertu.
Version actual estable: 1.0.2
Este repositorio contiene exclusivamente el SDK Python oficial del producto asertu Optimizer. La API del SDK esta pensada para integrarse de forma natural en aplicaciones que ya usan LLMs y necesitan registrar eventos, consultar analitica e incorporar historial e insights sin tratar asertu como un cliente REST generico.
Estado actual
La base del SDK ya incluye:
- cliente oficial
AsertuOptimizerClient - auth por
tenant_api_key,bearer_tokenytenant_id - eventos de observabilidad LLM
- tenants
- paginacion de tenants con
limit,cursore iteracion completa - analytics
- history
- billing
- settings
- paginacion adicional en
settings.members,settings.access_requestsysettings.invitations - insights y recommendations
- helpers para OpenAI, Anthropic y Bedrock
- constructor
AsertuOptimizerClient.from_env() - cliente async
AsyncAsertuOptimizerClient - telemetria opcional del SDK
- tests, ejemplo ejecutable y documentacion del repo
Documentacion
La documentacion funcional y de producto se referencia desde optimizer.asertu.ai.
Tambien puedes navegar el material tecnico directamente en el repositorio oficial:
En esta release publica inicial, el SDK se centra en:
- ingesta de eventos de observabilidad de IA
- discovery de tenants para usuarios autenticados
- analytics, insights, recommendations e history tenant-scoped
- billing y settings de workspace
- helpers para OpenAI, Anthropic y Bedrock
- soporte sync y async
Instalacion
pip install asertu-optimizer
Para desarrollo local:
python3 -m pip install -e ".[dev]"
Uso rapido
from asertu_optimizer import AsertuOptimizerClient
client = AsertuOptimizerClient.from_env()
client.events.track_openai_call(
model="gpt-4.1-mini",
feature="support_chat",
input_tokens=1200,
output_tokens=800,
status="success",
)
Para consultas tenant-scoped:
client = AsertuOptimizerClient(
base_url="https://api.optimizer.asertu.ai",
bearer_token="jwt-token",
tenant_id="tenant-123",
)
summary = client.analytics.dashboard_summary(preset="today")
Uso async:
from asertu_optimizer import AsyncAsertuOptimizerClient
async_client = AsyncAsertuOptimizerClient.from_env()
summary = await async_client.analytics.dashboard_summary(preset="today")
await async_client.aclose()
Contrato actual
El SDK toma como fuente de verdad el Swagger publicado del producto en optimizer.asertu.ai. Revalidado hoy, 7 de abril de 2026, el contrato publicado sube a version: 1.24.11 y cubre events, tenants, analytics, insights, recommendations, history, billing y settings.
Para eventos de ingesta, el contrato publico actual documenta ai.request.completed como valor por defecto recomendado para event_type, y el SDK queda alineado con ese comportamiento.
Los endpoints paginables publicados hoy son:
GET /v1/tenantsGET /v1/settings/membersGET /v1/settings/access-requestsGET /v1/settings/invitations
El SDK cubre esos flujos con limit, cursor e iteradores completos iter_all_*() tanto en sync como en async. En settings.invitations tambien expone resolve_invitation(token=...) para el flujo publico por token.
El SDK expone unicamente metodos respaldados por el Swagger/OpenAPI publicado. No incluye administracion global de plataforma ni placeholders para endpoints fuera del contrato.
Compatibilidad de proveedores
La compatibilidad documental de los helpers de instrumentacion esta verificada a fecha 2026-03-27 y se apoya en la documentacion oficial de cada proveedor.
En este momento:
- OpenAI: compatible con respuestas tipo
Responses APIy modelos comogpt-4.1-mini - Anthropic: compatible con
Messages APIy modelos documentados comoclaude-sonnet-4-20250514 - Bedrock: compatible con respuestas tipo
Conversey modelos comoanthropic.claude-sonnet-4-20250514-v1: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 asertu_optimizer-1.0.2.tar.gz.
File metadata
- Download URL: asertu_optimizer-1.0.2.tar.gz
- Upload date:
- Size: 34.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0501211e87007953a04b3782a32587e1973dd37f2516095aea20b14914cf58f
|
|
| MD5 |
e4f63ea6414851ee125f9cc4b8902b23
|
|
| BLAKE2b-256 |
c277974514afdc1675a6d30b2528b8e589ae586e42203b3d82a5a34ddd328c8d
|
Provenance
The following attestation bundles were made for asertu_optimizer-1.0.2.tar.gz:
Publisher:
publish.yml on asertuplatform/asertu-optimizer-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asertu_optimizer-1.0.2.tar.gz -
Subject digest:
f0501211e87007953a04b3782a32587e1973dd37f2516095aea20b14914cf58f - Sigstore transparency entry: 1247057140
- Sigstore integration time:
-
Permalink:
asertuplatform/asertu-optimizer-python@918031102a8521a48ba4676e1095227de3060ff3 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/asertuplatform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@918031102a8521a48ba4676e1095227de3060ff3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file asertu_optimizer-1.0.2-py3-none-any.whl.
File metadata
- Download URL: asertu_optimizer-1.0.2-py3-none-any.whl
- Upload date:
- Size: 34.7 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 |
ef07f649ed3c07d13aa1ece2f672c6fb4b70131ba05d3b5f442ce837c73d1048
|
|
| MD5 |
d323d79451bcd71b8c8b6b5e4317fb7b
|
|
| BLAKE2b-256 |
e23a40cfd9e3b1aff794aa1878148773af644b321e94995e51a93bf3ec10337c
|
Provenance
The following attestation bundles were made for asertu_optimizer-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on asertuplatform/asertu-optimizer-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asertu_optimizer-1.0.2-py3-none-any.whl -
Subject digest:
ef07f649ed3c07d13aa1ece2f672c6fb4b70131ba05d3b5f442ce837c73d1048 - Sigstore transparency entry: 1247057172
- Sigstore integration time:
-
Permalink:
asertuplatform/asertu-optimizer-python@918031102a8521a48ba4676e1095227de3060ff3 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/asertuplatform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@918031102a8521a48ba4676e1095227de3060ff3 -
Trigger Event:
release
-
Statement type: