Skip to main content

centml-python-client

Installation

This client uses Platform API 4.37.1. CServe deployments have been retired; the CServe SDK helpers and CLI deployment option are no longer available.

To install without cloning, run the following command:

pip install git+https://github.com/CentML/centml-python-client.git@main

Alternatively to build from source, clone this repo then inside the project's base directory, run the following command:

pip install . 

Authentication

For interactive use, authenticate once with the CLI. SDK examples reuse the stored credentials and refresh them when needed.

centml login
python examples/sdk/validate_auth.py

For service-to-service use, provide both service-account environment variables:

export CENTML_SERVICE_ACCOUNT_ID="<service-account-id>"
export CENTML_SERVICE_ACCOUNT_SECRET="<service-account-secret>"
python examples/sdk/validate_auth.py

CENTML_PLATFORM_API_URL can be set when targeting a non-production API.

Dynamo SDK example

The Dynamo example uses SDK authentication separately from the bearer token that protects the deployed inference endpoint:

export CENTML_CLUSTER_ID="<cluster-id>"
export CENTML_HARDWARE_INSTANCE_ID="<hardware-instance-id>"
export CENTML_ENDPOINT_BEARER_TOKEN="<new-endpoint-token>"
# Required only for gated Hugging Face models:
export HF_TOKEN="<hugging-face-token>"

python examples/sdk/create_dynamo.py

Use python examples/sdk/get_clusters.py and python examples/sdk/manage_hardware_instances.py to discover the required IDs. Creating the example reserves GPU capacity and may incur usage charges. It does not delete the deployment automatically.

Deployment logs SDK example

fetch_logs() is the one way to read deployment logs: it fetches one pod's stored log lines within a time window (start_time/end_time, epoch ms, inclusive) and yields them lazily, oldest first, as chunks of DeploymentLogEvent — each line at most once, holding only a short dedup window in memory however long the stream. chunk_size (1 to 5000) is the number of lines requested from the server per round trip and each server page that carries window lines becomes one chunk, so a bulk read of history wants a large chunk_size — the log read path is rate-limited upstream, and a small chunk_size over a large window multiplies requests. Discover pod names with get_deployment_pods() (terminated pods still within log retention are included). start_time defaults to the moment of the call; with end_time set the iterator terminates once the window is delivered or the store has no more lines to give, whichever comes first:

for chunk in cclient.fetch_logs(DEPLOYMENT_ID, REVISION, pod, start_time=t1_ms, end_time=t2_ms):
    for event in chunk:
        print(event.message)

Without end_time the same generator tails: it never terminates, and once caught up it yields an empty chunk each time nothing new is stored yet — the caller decides when to sleep or break:

import time

for chunk in cclient.fetch_logs(DEPLOYMENT_ID, REVISION, pod):
    if not chunk:
        time.sleep(2)
        continue
    for event in chunk:
        print(event.message)

python examples/sdk/get_deployment_logs.py runs both. get_deployment_logs(), get_deployment_logs_range() and deployment_log_session() still work but are deprecated in favor of fetch_logs() and emit a DeprecationWarning on use.

Un-installation

To uninstall centml, simply do:

pip uninstall centml

CLI

Once installed, use the centml CLI tool with the following command:

centml 

If you want tab completion, run

source scripts/completions/completion.<shell language>

Shell language can be: bash, zsh, fish (Hint: add source /path/to/completions/completion.<shell language> to your ~/.bashrc, ~/.zshrc or ~/.config/fish/completions/centml.fish)

Tests

To run tests, first install required packages:

pip install -r requirements-dev.txt
cd tests

When running on a local machine, it is recommended to run tests with the following command. This skips tests that require a GPU.

pytest --sanity

To run all the tests, use:

pytest

Common Issues

  • SSL certificate on MacOS

    Sometimes, you will see issues when using command like centml cluster [CMD], where the output might look like:

    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/urllib3/util/retry.py", line 519, in increment
    
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.centml.com', port=443):
    
    Max retries exceeded with url: /deployments
    
    (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)')))
    

    Solution: To fix this issue, navigate to your python installation directory and run the Install Certificates.command file located there.

    For example, if you are using python3.10, the file path would be: /Applications/Python 3.10/Install Certificates.command

Metadata

Release files for centml 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for centml 0.7.2
File Size Uploaded Provenance Actions
centml-0.7.2.tar.gz 46.0 kB With provenance Details for centml-0.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for centml 0.7.2
File Interpreter ABI Platform Actions
centml-0.7.2-py3-none-any.whl Python 3 none any Details for centml-0.7.2-py3-none-any.whl

Total release size: 78.5 kB

Release files / centml-0.7.2.tar.gz

Download URL centml-0.7.2.tar.gz
Size 46.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d0e57a3e59254e400f79548b977a43c380102e7889711669d463223d8f26ee09
BLAKE2b-256 checksum
How to use checksums
1d200cf3f71c7ad924c44182f18d1fcc424f3409c1d0fbf5c930d42708223ca3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 13, 2026.

Transparency log

Release files / centml-0.7.2-py3-none-any.whl

Download URL centml-0.7.2-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed0132f42fdbc0f642c223ece6d4b05e83225f6b908c9fd7f4bbf1e0f7c826b3
BLAKE2b-256 checksum
How to use checksums
d76cf10ba7d0c6c5abc55a7a0bce2f497f38d7165904baa2257e0432e8ac82c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 13, 2026.

Transparency log

Security for centml 0.7.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for centml-0.7.2.tar.gz

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 13, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page