Skip to main content

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. List models

from neuralhive import Client

client = Client("nh_live_your_api_key")
models = client.list_models()

2. Get model details

model = client.get_model("your_model_id")
print(model)

3. Run model inference

from neuralhive import Client

client = Client("nh_live_your_api_key")

result = client.detect(
    model_id="your_object_detection_model_id",
    image="<base64_image>",
)

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:

  • Client instance

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:

  • dict with model details

client.detect(model_id, image, prompt=None)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input
prompt str No Optional prompt (required for SAM-like IDs)

Returns:

  • dict

client.segment(model_id, image, prompt=None)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input
prompt str No Optional prompt (required for SAM-like IDs)

Returns:

  • dict

client.recognize(model_id, image)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input

Returns:

  • list[float] (face embeddings)

client.reidentify(model_id, image)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input

Returns:

  • dict

client.estimate_pose(model_id, image)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input

Returns:

  • dict

client.embed(model_id, text=None, image=None)

Parameter Type Required Description
model_id str Yes Target model identifier
text str No Text input
image str No Base64 image input

Notes:

  • Exactly one input is required: text or image

Returns:

  • list[float] or list[list[float]]

client.generate_text(model_id, prompt, image=None, images=None, videos=None)

Parameter Type Required Description
model_id str Yes Target model identifier
prompt str Yes Text prompt
image str No Single base64 image
images str or list[str] No Base64 image(s)
videos str or list[str] No Video URL(s) or base64 video input(s)

Returns:

  • str

client.analyze(model_id, text=None, images=None, videos=None)

Parameter Type Required Description
model_id str Yes Target model identifier
text str No Text input
images str or list[str] No Base64 image(s)
videos str or list[str] No Video URL(s) or base64 video input(s)

Notes:

  • At least one input is required: text or images or videos

Returns:

  • str

client.generate_image(model_id, prompt)

Parameter Type Required Description
model_id str Yes Target model identifier
prompt str Yes Text prompt

Returns:

  • str (generated image URL, empty string if unavailable)

client.generate_3d(model_id, image)

Parameter Type Required Description
model_id str Yes Target model identifier
image str Yes Base64 image input

Returns:

  • str (3D asset URL, empty string if unavailable)

Input Validation

  • model_id is required for all inference methods.
  • task_type is never required from user.
  • image and images must be base64-encoded strings when provided.
  • Unsupported fields for selected model are rejected before request dispatch.
  • Missing required fields for selected model are rejected before request dispatch.

Contract

Frozen contract file is included in repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralhive-1.1.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralhive-1.1.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file neuralhive-1.1.0.tar.gz.

File metadata

  • Download URL: neuralhive-1.1.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for neuralhive-1.1.0.tar.gz
Algorithm Hash digest
SHA256 31ea6a12bc987c03b7c5546648be392c300e99957ac2eefc96e0960d12324d41
MD5 884b7c94d9962f59ba52da339321e881
BLAKE2b-256 17be757efb7aa11b8992b3d84dd428dfbd9c9437dfd29a917e459cddf9835b22

See more details on using hashes here.

File details

Details for the file neuralhive-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: neuralhive-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for neuralhive-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3923f06a3969cab20bce3c0464c095b1ed652f994fa65b06457e1d1f3ed70d40
MD5 5d5a3fa1961fa67aa617e1c77ddfcb90
BLAKE2b-256 eccffc447f26337108cd978c40cec7e37e4f5aa05f967a46a2f22ca1bd4bb36b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page