Skip to main content

Python SDK for Alephant Gateway sessions, analytics, and framework integrations.

Project description

Alephant Python SDK

Alephant Python SDK helps you call Alephant Gateway, generate session headers, query Virtual Key usage and cost analytics, and integrate with LangChain or LlamaIndex.

Installation

pip install alephantai
pip install "alephantai[langchain]"
pip install "alephantai[llamaindex]"

Gateway Chat

The production Gateway host is https://ai.alephant.io/v1.

from alephantai import AlephantGatewayContext, create_openai_client

ctx = AlephantGatewayContext(session_name="quickstart")
client = create_openai_client(api_key="vk-...", context=ctx)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

By default, the SDK only generates Alephant-Session-Id. Behavior headers such as cache controls, forced routing, and prompt template identifiers must be configured explicitly. Version 1 guarantees session-level request and cost attribution only; full journey steps, policy events, and grading require a future step/span contract.

Analytics

The Cockpit analytics client defaults to https://alephant.io/api/v1.

from alephantai import AlephantAnalyticsClient

analytics = AlephantAnalyticsClient(api_key="vk-...")
print(analytics.usage_summary(period="7d"))

usage_summary().total_tokens.input maps to prompt/input tokens and total_tokens.output maps to completion/output tokens. daily_costs() reports daily total tokens. cost_by_model() is scoped to the VK's bound agent/member when present, and recent_requests() returns live rows; degraded=true means the backend, Collector, or requested scope could not provide live data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alephantai-0.1.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alephantai-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file alephantai-0.1.0.tar.gz.

File metadata

  • Download URL: alephantai-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for alephantai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 24f92dac962c18657ddca74911e5be4770bf7fa487f119997c39b1855c260685
MD5 2fc5c34617698abdb0dfcae594dcf5a2
BLAKE2b-256 15c037a34cc9a0865917cad5f0b54547279bab31bcefee652e0b24d33678430a

See more details on using hashes here.

File details

Details for the file alephantai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: alephantai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for alephantai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef03705a2c533b3ba5c50beea117dea7ccf6eb2526a7f57513802ca44b5f579
MD5 1287f13add979acc7e3ed3adf89eda24
BLAKE2b-256 c77cdad0287c174f29e6d7150743ac170953bb4de55fa459f520cbff9adca177

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page