Python SDK for Xinference Cloud management APIs
Project description
Xinference Cloud Python SDK
Official Python SDK for the Xinference Cloud management APIs: browse the deployable model catalog, create and manage model deployments, and issue inference API keys — all from Python.
Installation
pip install xinference-cloud
Requires Python 3.11 or later. The only runtime dependency is httpx.
Authentication
The SDK authenticates with an SDK management credential scoped to your organization. You can obtain one in two ways:
-
Console UI — the SDK Credentials page in the Xinference Cloud console (in development, rolling out soon).
-
Management API — while signed in to the console, create one via
POST /api/v1/organization/sdk-credentials:// Run in your browser DevTools console while signed in const res = await fetch("/api/v1/organization/sdk-credentials", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: "my-sdk-credential" }), }); console.log((await res.json()).key);
The credential key is shown only once at creation time — store it securely. If you lose it, revoke the credential and create a new one.
Quickstart
from xinference_cloud import XinferenceCloud
client = XinferenceCloud(
base_url="https://<your-region>.cloud.xinference.co",
credential="<your-sdk-credential>",
)
with client:
# Browse the deployable model catalog
models = client.deployable_models.list(enabled_only=True)
# Deploy a model and wait until it is running
deployment = client.deployments.create(model_name="qwen2.5-instruct")
deployment = client.deployments.wait(deployment["id"], timeout=600)
# Issue an inference API key bound to the deployment
api_key = client.inference_api_keys.create(
name="production",
deployment_ids=[deployment["id"]],
)
Instead of passing arguments explicitly, you can set the
XINFERENCE_CLOUD_BASE_URL and XINFERENCE_CLOUD_CREDENTIAL environment
variables and construct the client with XinferenceCloud.from_env().
Resources
| Resource | Methods |
|---|---|
client.deployable_models |
list, get |
client.deployments |
create, list, list_page, get, wait, terminate, delete |
client.inference_api_keys |
list, list_deployment_options, create, update, revoke |
deployments.wait() polls a deployment until it reaches a target status
(running by default), raises RuntimeError if it enters a failure status,
and raises TimeoutError on timeout.
Error handling
API errors raise xinference_cloud.APIStatusError, which carries the HTTP
status_code, the server error code (when provided), and the raw
httpx.Response:
from xinference_cloud import APIStatusError
try:
client.deployments.get("unknown-id")
except APIStatusError as exc:
print(exc.status_code, exc.code, str(exc))
License
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 xinference_cloud-0.1.0.tar.gz.
File metadata
- Download URL: xinference_cloud-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697c3fa8778093d51a4659c0b1a5b591eac932b93fcf22f5ec297cf2f7183223
|
|
| MD5 |
9d5f75cace8b0287d439aebf13b2bc16
|
|
| BLAKE2b-256 |
1073cb9dc755ca49a6d6c38c0f7e340e3fefb601501b7b048c24f6d0546071a9
|
Provenance
The following attestation bundles were made for xinference_cloud-0.1.0.tar.gz:
Publisher:
sdk-publish.yml on xorbitsai/xinference-saas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xinference_cloud-0.1.0.tar.gz -
Subject digest:
697c3fa8778093d51a4659c0b1a5b591eac932b93fcf22f5ec297cf2f7183223 - Sigstore transparency entry: 2144184012
- Sigstore integration time:
-
Permalink:
xorbitsai/xinference-saas@4b87d2784d5b934c8bdfc2aa6f5d8192ac0aafa1 -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/xorbitsai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@4b87d2784d5b934c8bdfc2aa6f5d8192ac0aafa1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xinference_cloud-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xinference_cloud-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5a3786017efab6d6198ddbece495141fd7613f659ae259c242b16132ddf1425
|
|
| MD5 |
3ed79dd2f210fed67a0ea43cea75081f
|
|
| BLAKE2b-256 |
2fe394a1b559459fb9396196f54c7ed072094a5155a9bc9b9028ef1e2383e154
|
Provenance
The following attestation bundles were made for xinference_cloud-0.1.0-py3-none-any.whl:
Publisher:
sdk-publish.yml on xorbitsai/xinference-saas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xinference_cloud-0.1.0-py3-none-any.whl -
Subject digest:
a5a3786017efab6d6198ddbece495141fd7613f659ae259c242b16132ddf1425 - Sigstore transparency entry: 2144184410
- Sigstore integration time:
-
Permalink:
xorbitsai/xinference-saas@4b87d2784d5b934c8bdfc2aa6f5d8192ac0aafa1 -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/xorbitsai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@4b87d2784d5b934c8bdfc2aa6f5d8192ac0aafa1 -
Trigger Event:
push
-
Statement type: