Catalog PyPI
PACKAGE EXPLORERView in registry

adityalab

PyPI

Official Python client for the Aditya API (Indian-language AI models by Aditya Lab)

adityaaiapihindiindicllmsdk
Versions collected1
Direct dependencies2From release 0.1.0
Last observed20 Oct, 19:34 UTC

README

Version 0.1.0 documentation

adityalab — Python client for the Aditya API

The official Python library for Aditya, a family of AI models built for Indian languages.

pip install adityalab

Python 3.9+. Its only dependency is httpx.

Quick start

Create an API key at platform.adityalab.in, then:

export ADITYA_API_KEY="bk_..."
from adityalab import Aditya

client = Aditya()   # reads ADITYA_API_KEY

reply = client.chat.completions.create(
    model="aditya-latest",
    messages=[{"role": "user", "content": "Explain an API in Hindi."}],
)
print(reply.text)

reply is the standard chat-completion object, so reply.choices[0].message.content and reply.usage.total_tokens work too.

Streaming

with client.chat.completions.create(
    model="aditya-latest",
    messages=[{"role": "user", "content": "Tell me a short story in Tamil."}],
    stream=True,
) as stream:
    for piece in stream.text():
        print(piece, end="", flush=True)

To read the raw chunks instead of only the text, iterate stream directly.

Conversations kept on the server

Pass conversation="new" on the first call. After that, send only the new message with the returned id, and the server supplies the earlier turns:

first = client.chat.completions.create(
    model="aditya-latest",
    messages=[{"role": "user", "content": "मेरा नाम रिया है।"}],
    conversation="new",
)
cid = first.conversation_id

second = client.chat.completions.create(
    model="aditya-latest",
    messages=[{"role": "user", "content": "मेरा नाम क्या है?"}],
    conversation=cid,
)
print(second.text)

Calls without conversation are stateless, and nothing is stored.

To list, read and delete stored conversations:

for conv in client.conversations.iter():
    print(conv.id, conv.title)

page = client.conversations.messages(cid)      # .items, .nextAfter
client.conversations.delete(cid)

Models, credits and pricing

client.models.list()          # the models your key can call
client.credits.balance()      # .balance (in credits), .planTier
client.credits.usage()        # spend over the last 5 hours, day and 30 days
client.pricing.retrieve()     # public price list

Async

import asyncio
from adityalab import AsyncAditya

async def main():
    async with AsyncAditya() as client:
        reply = await client.chat.completions.create(
            model="aditya-latest", messages=[{"role": "user", "content": "नमस्ते"}])
        print(reply.text)

        stream = await client.chat.completions.create(
            model="aditya-latest", messages=[{"role": "user", "content": "नमस्ते"}], stream=True)
        async for piece in stream.text():
            print(piece, end="")

asyncio.run(main())

Errors

Every API error is raised as a typed exception. Each one has .status_code, .code (a stable string to branch on), .message and .request_id; quote the request id when you contact support.

import adityalab

try:
    client.chat.completions.create(model="aditya-latest", messages=[...])
except adityalab.InsufficientCreditsError:
    ...  # top up at platform.adityalab.in
except adityalab.RateLimitError as e:
    ...  # e.code == "window_cap_reached" means your plan's 5-hour window is used up; see e.retry_after
except adityalab.AuthenticationError:
    ...  # wrong, revoked or expired key
except adityalab.APIConnectionError:
    ...  # network trouble, or a timeout (APITimeoutError)
ExceptionWhen
BadRequestError400: the request is malformed
AuthenticationError401: missing, invalid, revoked or expired key
InsufficientCreditsErrorout of credits
PermissionDeniedError403
NotFoundError404: unknown model or conversation
RateLimitError429
InternalServerError5xx, including a busy model (model_busy)
StreamErrorthe model stopped partway through a stream

Retries and timeouts

The client retries automatically, up to max_retries times (default 2):

  • a busy model or rate limit (the server refused before doing any work);
  • 5xx errors on reads;
  • network errors.

It never re-sends a conversation turn after the server may have stored it. It also does not wait out a long Retry-After, such as a used-up usage window; you get the error straight away.

client = Aditya(timeout=60, max_retries=3)
client.chat.completions.create(..., timeout=10)   # per call

OpenAI compatibility

The API is also OpenAI-compatible, so existing OpenAI code works with base_url="https://api.adityalab.in/v1". Use this library to get typed errors, server-side conversations, and the credits and pricing calls.

Configuration

OptionEnvironment variableDefault
api_keyADITYA_API_KEYnone (required)
base_urlADITYA_BASE_URLhttps://api.adityalab.in/v1
timeoutnone120 seconds
max_retriesnone2

Pass http_client=httpx.Client(...) to set up proxies or custom TLS.

License

Apache-2.0

Downloads & popularity

2downloads
1-day window · source-reported counts19 Oct 2026
8341.50
2026-10-08: 83 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-08–2026-10-082026-10-09: 20 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-09–2026-10-092026-10-10: 3 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-10–2026-10-102026-10-11: 2 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-11–2026-10-112026-10-13: 1 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-13–2026-10-132026-10-14: 3 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-14–2026-10-142026-10-15: 3 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-15–2026-10-152026-10-17: 2 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-17–2026-10-172026-10-18: 1 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-18–2026-10-182026-10-19: 2 · observed 2026-10-20T20:15:15.8521266Z · period 2026-10-19–2026-10-19
8 Oct19 Oct

pypistats · 10 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-19 – 2026-10-1922026-10-20T20:15:15.8521266Z
2026-10-18 – 2026-10-1812026-10-20T20:15:15.8521266Z
2026-10-17 – 2026-10-1722026-10-20T20:15:15.8521266Z
2026-10-15 – 2026-10-1532026-10-20T20:15:15.8521266Z
2026-10-14 – 2026-10-1432026-10-20T20:15:15.8521266Z
2026-10-13 – 2026-10-1312026-10-20T20:15:15.8521266Z
2026-10-11 – 2026-10-1122026-10-20T20:15:15.8521266Z
2026-10-10 – 2026-10-1032026-10-20T20:15:15.8521266Z
2026-10-09 – 2026-10-09202026-10-20T20:15:15.8521266Z
2026-10-08 – 2026-10-08832026-10-20T20:15:15.8521266Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.08 Oct 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
shivam-9090/aroxa

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:34 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:22ce882fe8a39949427ba5eec754bb3d3186d113f0e59dcb0f61f2e9ef2f57e8