Official Python SDK for Hexa AI - Lightning-Fast AI API
Project description
Hexa Generative AI - Python SDK
Official Python client for Hexa AI API.
Installation
pip install hexgenerative
Quick Start
from hexgenerative import HexaAI
# Initialize client
client = HexaAI(api_key="hgx-your-api-key")
# Create chat completion
response = client.chat.completions.create(
model="hexa-pro",
messages=[
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
)
print(response.choices[0].message.content)
Available Models
| Model | Description | Best For |
|---|---|---|
hexa-instant |
Fastest model | Quick responses, simple tasks |
hexa-balanced |
General purpose | Most use cases |
hexa-reasoning |
Deep analysis | Complex reasoning |
hexa-advanced |
Coding expert | Programming tasks |
hexa-pro |
Premium quality | Best results |
hexa-vision-scout |
Vision model | Image understanding |
Smart Routing
Let Hexa AI pick the best model automatically:
# By task type
response = client.chat.completions.create(
task="coding",
messages=[{"role": "user", "content": "Write a Python function"}]
)
# By optimization preference
response = client.chat.completions.create(
optimize_for="speed",
messages=[{"role": "user", "content": "Quick answer please"}]
)
# Full auto-select
response = client.chat.completions.create(
auto_select=True,
messages=[{"role": "user", "content": "Your message"}]
)
Async Support
import asyncio
from hexgenerative import HexaAI
client = HexaAI(api_key="hgx-your-api-key")
async def main():
response = await client.chat.completions.acreate(
model="hexa-pro",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())
Error Handling
from hexgenerative import HexaAI
from hexgenerative.client import HexaAIError
client = HexaAI(api_key="hgx-your-api-key")
try:
response = client.chat.completions.create(
model="hexa-pro",
messages=[{"role": "user", "content": "Hello"}]
)
except HexaAIError as e:
print(f"Error: {e.message}")
print(f"Status: {e.status_code}")
License
MIT
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
hexgenerative-1.0.0.tar.gz
(5.5 kB
view details)
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 hexgenerative-1.0.0.tar.gz.
File metadata
- Download URL: hexgenerative-1.0.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cb626db1f36361744bfc15f22b3a16ea8e0824e9bfd20acaedf6d1491894735
|
|
| MD5 |
12deed43438a29b4ab1c83c216b800dc
|
|
| BLAKE2b-256 |
35c9162294350bf971aa0676e7e7240cd60befd8c6504750fa16e4ddb74c5d4a
|
File details
Details for the file hexgenerative-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hexgenerative-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7d9ccd066202fede44da987d1b62af4cadfb2a4080af36d92737076bb5ad64e
|
|
| MD5 |
c6e4f15ad8ed09560514f1048cc23db0
|
|
| BLAKE2b-256 |
c67d251e412948dc4ef11e990c96b111cf292f52195a3a46071fe96d3adb7329
|