NeuralHive Python SDK for model access and inference
Project description
NeuralHive SDK
Python SDK client for NeuralHive model access.
Installation
pip install neuralhive
Authentication Setup
Option 1: Configure once (recommended)
neuralhive configure --api-key nh_live_your_api_key
Then use SDK without passing key in code.
Option 2: Environment variable
export NEURALHIVE_API_KEY="nh_live_your_api_key"
Option 3: Pass key directly in code
client = Client("nh_live_your_api_key")
Quick Start
from neuralhive import Client
client = Client()
models = client.list_models()
print(models)
Usage
1. Get model details
model = client.get_model("your_model_id")
print(model)
2. Run model inference
from neuralhive import Client
client = Client()
result = client.detect(
image_path="/absolute/path/to/image.jpg",
)
For all other methods, see API Reference below.
API Reference
Client(api_key: str | None = None)
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
str |
No | Your NeuralHive API key |
Returns:
Clientinstance
Notes:
- Authentication is validated automatically on first API call.
- Production recommendation: avoid hardcoded API keys in source code.
client.list_models()
Parameters:
- None
Returns:
list[dict]containing allowed models for this API key
client.get_model(model_id)
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id |
str |
Yes | Target model identifier |
Returns:
dictwith model details
client.detect(image_path, model_id=None, prompt=None, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
model_id |
str |
No | Target model identifier |
prompt |
str |
No | Optional prompt (required for SAM-like IDs) |
export_to |
str |
No | Export directory path for box-rendered image |
Notes:
- If
model_idis not provided, SDK uses defaultobject_detectionmodel from your allowed models.
Returns:
dict
client.segment(image_path, model_id=None, prompt=None, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
model_id |
str |
No | Target model identifier |
prompt |
str |
No | Optional prompt (required for SAM-like IDs) |
export_to |
str |
No | Export directory path for mask-rendered image |
Returns:
dict
Notes:
- If
model_idis not provided, SDK uses defaultinstance_segmentationmodel from your allowed models.
client.detect_and_segment(image_path, prompt, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
prompt |
str |
Yes | Segmentation prompt |
export_to |
str |
No | Export directory path for mask+box-rendered image |
Notes:
- Uses SAM3 / prompt-based segmentation models.
Returns:
dict
client.recognize(image_path)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
Returns:
list[list[float]](face embeddings per detected face)
client.reidentify(image_path, model_id=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
model_id |
str |
No | Target model identifier |
Returns:
dict
client.estimate_pose(image_path, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
export_to |
str |
No | Export directory path for pose-rendered image |
Returns:
dictwith:keypoints:list[object]scores:list[object]saved_path:str | None
client.embed(text=None, image_path=None, model_id=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
str |
No | Text input |
image_path |
str |
No | Local image file path |
model_id |
str |
No | Target model identifier |
Notes:
- Exactly one input is required:
textorimage_path - If
model_idis not provided, SDK uses the defaultclipmodel from your allowed models.
Returns:
list[float]orlist[list[float]]
client.generate_text(prompt, model_id=None, image_paths=None, video_paths=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
str |
Yes | Text prompt |
model_id |
str |
No | Target model identifier |
image_paths |
str or list[str] |
No | Local image file path(s) |
video_paths |
str or list[str] |
No | Local video path(s) or public URL(s) |
Notes:
- If
model_idis not provided, SDK uses defaultvlmmodel from your allowed models.
Returns:
str
client.analyze(text=None, image_paths=None, video_paths=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
str |
No | Text input |
image_paths |
str or list[str] |
No | Local image file path(s) |
video_paths |
str or list[str] |
No | Local video path(s) or public URL(s) |
Notes:
- At least one input is required:
textorimage_pathsorvideo_paths
Returns:
str
client.generate_image(prompt, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
str |
Yes | Text prompt |
export_to |
str |
No | Export directory path (filename comes from response URL) |
Returns:
dictwith:download_url:strsaved_path:str | None
client.edit_image(image_path, prompt, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
prompt |
str |
Yes | Text instruction for the edit |
export_to |
str |
No | Export directory path (filename comes from response URL) |
Returns:
dictwith:download_url:strsaved_path:str | None
client.generate_3d(image_path, export_to=None)
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path |
str |
Yes | Local image file path |
export_to |
str |
No | Export directory path (filename comes from response URL) |
Returns:
dictwith:download_url:strsaved_path:str | None
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
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 neuralhive-1.1.4.tar.gz.
File metadata
- Download URL: neuralhive-1.1.4.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
147d0836620e0fe025d4f0f78520e9a88c0011c499e7740d7c36bd3c10521e90
|
|
| MD5 |
be2fd6b58deaf6e65e1c665fa0566b44
|
|
| BLAKE2b-256 |
9d5e44b510bcfbf30c4ac275a9533ba93013de1886402d43201127051020c1de
|
File details
Details for the file neuralhive-1.1.4-py3-none-any.whl.
File metadata
- Download URL: neuralhive-1.1.4-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44112d8296f49d7243789e0a95bd093d5fcae4ee0dd12cb44d30d96b4f97e2b4
|
|
| MD5 |
563b27726c691bd7fdd872d36d375288
|
|
| BLAKE2b-256 |
9bffbdb0a48bb3ffc89f2d0af4724d9868fe27c410211d0c5d73d6c47f55365b
|