Skip to main content
Neural Defend

NeuralDefend Python SDK

The official Python package is neuraldefend 1.0.2 for Python 3.9 or newer. Install the pinned release, provide NEURALDEFEND_API_KEY or pass api_key to NeuroVerifyClient, and call detect_image or detect_video. Methods return immutable ImageResult or VideoResult objects for scored and rejected outcomes. Branch on status or the scored and rejected helpers, use to_dict for stable normalized fields, and reserve raw for sanitized diagnostics rather than application logic.

Maintained byNeural Defend
Updated August 7, 2026
Siva Shankar, Co-founder and CTO of Neural Defend.
Siva ShankarCo-founder & CTO
An article-specific diagram for NeuralDefend Python SDK organizes key sections including install and configure, call and read results, errors, retries, and lifecycle.

Install and configure

Install neuraldefend 1.0.2 in the same environment as the application. The guide requires Python 3.9 or newer. Obtain a key through Neural Defend onboarding and expose it through NEURALDEFEND_API_KEY or the explicit api_key constructor option.

The production client uses the production origin. NeuroVerifyClient.staging creates a staging client. Use a credential scoped to the selected environment and do not enable a custom base URL unless the integration has a reviewed reason.

Call and read results

detect_image returns ImageResult. detect_video returns VideoResult and accepts documented frame-sampling options. Paths are streamed from a validated file handle. Byte input and unnamed streams require a filename so multipart metadata remains deterministic.

Use result.to_dict for stable normalized output. The raw property retains a sanitized immutable score envelope for explicit diagnostics, but it is not the stable application contract.

  • scored is true only for a recognized successful score.
  • rejected identifies a business rejection without converting it into an exception.
  • ImageResult.high_risk identifies the documented high band.
  • VideoResult.has_audio preserves whether an audio score is present.
An article-specific topic map for NeuralDefend Python SDK organizes key sections including call and read results, errors, retries, and lifecycle, install and configure.

Errors, retries, and lifecycle

Public exceptions derive from NeuroVerifyError and distinguish validation, authentication, scope, rate-limit, server, timeout, network, protocol, and other HTTP failures. Catch specific classes and keep request identifiers when provided.

The client applies bounded retries to documented 429, 500, and 503 responses. It does not retry timeouts or network failures. Use a context manager or call close so the underlying HTTP resources are released.

Evidence boundary

Limitations

  • The verified release is 1.0.2 as of the source check date; confirm PyPI and the package changelog before pinning a new deployment.

Source record

Sources and references

  1. Neural DefendNeuralDefend Python SDK guideVerified August 7, 2026.
  2. Python Package Indexneuraldefend 1.0.2Published July 27, 2026. Verified August 7, 2026.

Integrate the result

Apply a complete screening recipe

Connect SDK calls to authorization, status-first handling, review routing, and audit correlation.

Browse integration recipes