InferCrane Python SDK
Typed Python client for the InferCrane control API and OpenAI-compatible inference gateway. The package has no runtime dependencies and supports Python 3.10 or newer.
Install
python3 -m venv .venv
.venv/bin/python -m pip install 'infercrane==2.3.0'
Run your code with .venv/bin/python, or source .venv/bin/activate first. A stock Mac has no
python command, and Homebrew's python3 refuses pip install outside a virtual environment.
Use the SDK version from the same InferCrane release as the control plane.
Configure
Name the control plane and the key in the environment. For the hosted service, create a key in the
dashboard under Settings → Keys, or with infercrane principal create:
export INFERCRANE_URL=https://api.infercrane.com
export INFERCRANE_API_KEY=YOUR_CONTROL_API_KEY
from infercrane import InferCrane
infercrane = InferCrane()
For a self-hosted or local control plane, set INFERCRANE_URL to its address instead.
The control URL comes from the first of: the base_url argument, INFERCRANE_CONTROL_URL, and
INFERCRANE_URL (the CLI reads the same two variables in the same order). An empty variable counts
as unset. With none of them, a key passed as api_key goes to the hosted service; a key from
INFERCRANE_API_KEY is refused with an error instead, because a server's environment often holds
its own operator key there. The gateway URL is gateway_url when given, otherwise the control
URL's host.
Pass base_url, gateway_url, or api_key to the constructor when environment configuration is not
appropriate. Use ca_file, cert_file, and key_file for a private CA or mutual TLS. Keep
control-plane credentials in trusted server processes.
Deploy and wait
operation = infercrane.deploy(
model="Qwen/Qwen3-8B",
name="support-production",
endpoint_name="support-production",
cloud="runpod",
gpu="L40S",
min_replicas=1,
max_replicas=2,
)
completed = infercrane.wait(operation.id, timeout=900)
print(completed.status)
print(completed.result.get("endpoint_name"))
name identifies the deployment operation. endpoint_name is the stable model alias used by the
application and defaults to name.
wait observes durable server-side work. A timeout or process exit does not cancel the operation.
Call cancel(operation.id) only when cancellation is intentional.
Stream inference
for event in infercrane.stream_chat(
"support-production",
[{"role": "user", "content": "Summarize the incident."}],
):
print(event, flush=True)
AsyncInferCrane provides the same common workflows for async applications.
Set an objective and request evidence
infercrane.set_slo_policy(
"support-production",
max_ttft_p95_ms=250,
max_error_rate=0.01,
)
recommendation = infercrane.recommend("support-production")
Recommendations preserve unavailable evidence instead of inventing a metric or price.
Errors and full API access
from infercrane import APIError, OperationFailed, OperationTimeout
try:
infercrane.wait(operation.id, timeout=30)
except OperationTimeout:
print("The operation is still running.")
except OperationFailed as error:
print(error.operation)
except APIError as error:
print(error.code, error.remediation)
The ergonomic methods cover common deployment and inference workflows. infercrane.api exposes the
complete generated control API with the same authentication and error contract.
See the Python SDK guide, control API, and security guidance.
License
Metadata
Release files for infercrane 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| infercrane-2.3.0-py3-none-any.whl | Python 3 | none | any | Details for infercrane-2.3.0-py3-none-any.whl |
Release files / infercrane-2.3.0-py3-none-any.whl
| Download URL | infercrane-2.3.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91669ebead92ecf5e6f39ef0bd2353626602167f12d27fd870c80133b4284b9f
|
|
BLAKE2b-256 checksum How to use checksums |
447ca0bdff881db71a9e224e4988bcdd51bb0fb71dc0a21e3c6005e9ec5aa479
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for infercrane 2.3.0
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.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for infercrane-2.3.0-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA 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.