Synexa Python Client
This is a Python client for Synexa AI. It lets you run AI models from your Python code or Jupyter notebook.
Requirements
- Python 3.8+
Installation
pip install synexa
Authentication
Before running any Python scripts that use the API, you need to set your Synexa API key in your environment:
export SYNEXA_API_KEY=your-api-key
Alternatively, you can pass the API key directly when creating a client:
client = synexa.Synexa(api_key="your-api-key")
Usage
Here's a simple example of how to use the client:
import synexa
# Run a model
output = synexa.run(
"black-forest-labs/flux-schnell",
input={"prompt": "An astronaut riding a rainbow unicorn, cinematic, dramatic"}
)
# Save the generated image
for i, img in enumerate(output):
with open(f'output_{i}.webp', 'wb') as f:
f.write(img.read())
Async Support
The client supports both synchronous and asynchronous operations. By default, it will wait for the prediction to complete (up to 60 seconds). You can modify this behavior:
# Don't wait for completion
output = synexa.run(
"black-forest-labs/flux-schnell",
input={"prompt": "An astronaut riding a rainbow unicorn"},
wait=False
)
# Wait with custom timeout (in seconds)
output = synexa.run(
"black-forest-labs/flux-schnell",
input={"prompt": "An astronaut riding a rainbow unicorn"},
wait=30
)
Error Handling
The client will raise exceptions for various error conditions:
ModelError: Raised when the prediction failsTimeoutError: Raised when the prediction doesn't complete within the specified timeoutValueError: Raised when required parameters are missing or invalidhttpx.HTTPError: Raised for HTTP-related errors
Example error handling:
from synexa import ModelError
try:
output = synexa.run(
"black-forest-labs/flux-schnell",
input={"prompt": "An astronaut riding a rainbow unicorn"}
)
except ModelError as e:
print(f"Prediction failed: {e}")
if e.prediction:
print(f"Prediction ID: {e.prediction['id']}")
License
MIT License
Metadata
Release files for synexa 0.1.1
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 |
|---|---|---|---|---|
| synexa-0.1.1.tar.gz | 4.8 kB | Without provenance | Details for synexa-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| synexa-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for synexa-0.1.1-py3-none-any.whl |
Total release size: 9.6 kB
Release files / synexa-0.1.1.tar.gz
| Download URL | synexa-0.1.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b8aaf91a1f39ce62fe4b98f7d74060fbda6f560bcf06288ecee8ebbc166d993
|
|
BLAKE2b-256 checksum How to use checksums |
b68be3d57cae56994ebd9ca14217c094032d5713045f8a10cee5c291be602881
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / synexa-0.1.1-py3-none-any.whl
| Download URL | synexa-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08d0f0652dfab7432bba43a67c9223ff4f4dfbaee0009ec0b32289530ecd80c1
|
|
BLAKE2b-256 checksum How to use checksums |
f6ff99f9beafc147af42f0fe880109ca5cb64404dfdc9e196a42946206164a4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for synexa 0.1.1
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.