aiqlick — Python client
A thin wrapper over the official openai package for the
AIQLick inference API.
Deliberately thin. The whole product claim is that the API is OpenAI-compatible,
so a client that reimplemented the protocol could drift away from that claim
without anyone noticing. AIQLick subclasses OpenAI, so anything the official
client does — streaming, tool calling, retries, async, whatever it adds next —
works here unchanged.
Install
pip install aiqlick
Use
from aiqlick import AIQLick, Models
client = AIQLick(api_key="sk-...") # or set AIQLICK_API_KEY
reply = client.chat.completions.create(
model=Models.CHAT_DEFAULT,
messages=[{"role": "user", "content": "hello"}],
)
print(reply.choices[0].message.content)
Streaming works exactly as it does with the official client:
stream = client.chat.completions.create(
model=Models.CHAT_DEFAULT,
messages=[{"role": "user", "content": "hello"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Models
Use the aliases, not provider model ids:
| Constant | Alias |
|---|---|
Models.CHAT_PREMIUM |
aiqlick/chat-premium |
Models.CHAT_DEFAULT |
aiqlick/chat-default |
Models.CHAT_CHEAP |
aiqlick/chat-cheap |
Models.EXTRACT_DEFAULT |
aiqlick/extract-default |
Models.EXTRACT_FAST |
aiqlick/extract-fast |
Models.EMBED_DEFAULT |
aiqlick/embed-default |
The mapping from an alias to a specific provider model is a platform decision that changes without callers changing — that is the entire point of the gateway. Pinning a provider id in your own code gives that up.
Your key may be scoped to a subset. client.models.list() returns only what it
can actually call.
Errors
The OpenAI SDK gives you a status and a message. specific_error() promotes our
code onto a typed exception, which is what lets you tell "out of credits" from
"subscription lapsed" — the same 402 with entirely different fixes.
import openai
from aiqlick import specific_error, InsufficientCredits
try:
client.chat.completions.create(...)
except openai.APIStatusError as exc:
err = specific_error(exc)
if isinstance(err, InsufficientCredits):
... # top up or upgrade the plan
raise err or exc
specific_error() returns None for anything it does not recognise rather than
guessing, so a provider error never gets mislabelled as a platform error.
| Exception | code |
|---|---|
InsufficientCredits |
INSUFFICIENT_CREDITS |
SubscriptionInactive |
SUBSCRIPTION_INACTIVE |
ModelNotAllowed |
LLM_MODEL_NOT_ALLOWED |
GatewayUnavailable |
LLM_GATEWAY_UNAVAILABLE |
Configuration
| Variable | Default |
|---|---|
AIQLICK_API_KEY |
— |
AIQLICK_BASE_URL |
https://api.aiqlick.com/llm/v1 |
Reading the base URL from the environment means one build can be pointed at dev or a self-hosted deployment without a code change.
Not using this client
You do not have to. The API is OpenAI-compatible, so the official client works directly — this package only saves you the base URL and the constants:
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://api.aiqlick.com/llm/v1")
Full documentation: https://docs.aiqlick.com
Metadata
Release files for aiqlick 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| aiqlick-0.1.0.tar.gz | 4.7 kB | Without provenance | Details for aiqlick-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiqlick-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for aiqlick-0.1.0-py3-none-any.whl |
Total release size: 10.5 kB
Release files / aiqlick-0.1.0.tar.gz
| Download URL | aiqlick-0.1.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9eff5722c4d8141b86faadca21ecca0b8c8774ce81f7f739054d66a23ea45ac
|
|
BLAKE2b-256 checksum How to use checksums |
26d36ffb868e11f78ebf064c243c21f0ecc0231e8592177434eb04706af63dda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / aiqlick-0.1.0-py3-none-any.whl
| Download URL | aiqlick-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96a40b3afe584e77a987dcf9ce739f1c548241759ae0fe6fbdc6cafea81ab8e6
|
|
BLAKE2b-256 checksum How to use checksums |
69e05a29d2abb1675a136d7c2c1e2e00494fcb5a24b1300e4b272aa29b224991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for aiqlick 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.