Skip to main content

Kitani CLI and Python SDK

Authorize a Kitani account, fund its prepaid balance, and run inference from a terminal. Commands work interactively or emit JSON for agent runners. The Python client reuses HTTP connections and streams model output without buffering the entire response.

PyPI · Agents · Agent skill · API documentation

Install

Requires Python 3.10 or later. Install the released CLI from PyPI with pipx:

pipx install kitani
kitani --version

For the Python SDK, run python -m pip install kitani in your virtual environment. For local wallet signing, install 'kitani[wallet]'. To install the development version from source, run pipx install 'git+https://github.com/kitani-inc/kitani-cli.git' or pipx install . from a clone.

If you installed the earlier kitani-cli package through pipx, run pipx uninstall kitani-cli and then pipx install kitani. For a pip environment, run python -m pip uninstall kitani-cli before installing kitani. Both packages provide the same Python module and terminal command. Your saved Kitani profile is separate from the package installation.

Interactive commands check PyPI at most once per day per profile and print the upgrade command to stderr when a newer stable release supports your Python version. For a standard pipx install, run pipx upgrade kitani. JSON output, redirected streams, CI, and doctor --offline skip the check. Set KITANI_NO_UPDATE_CHECK=1 to disable it.

First inference request

  1. Run kitani signup. Confirm the displayed code on kitani.ai, choose a new fingerprint-only account or sign into an existing account, and complete Turnstile. For SSH or CI, run kitani signup --no-browser --json, give the verification URL and code to the person approving, then run kitani signup --resume in the original profile. Approval expires after ten minutes.
  2. Run kitani whoami and kitani keys create --name agent. The CLI saves the inference key. Preserve the fingerprint for an email-less account in a password manager. Use kitani keys export fingerprint in a private terminal or pipe its output into your secret store.
  3. Run kitani fund link --via paypal --usd 10 --json. Share the returned payment_url with the payer. Check the credit with kitani fund status PAYMENT_ID --wait.
  4. Run kitani models --json, then kitani chat --model MODEL_ID "Hello from Kitani" with an available model ID. Add --stream for incremental text or --stream --json for newline-delimited JSON.

Model catalog and pricing

kitani models                             # list model IDs
kitani models qwen/qwen3.8-27b-uncensored --json
kitani pricing --online                   # rates and reported online miners
kitani pricing qwen/qwen3.8-27b-uncensored --json

Pricing comes from the same public snapshot as the website. Input, output and cached prices are USD per million tokens. Image rates are USD per image. The network total counts unique online miners; a miner may serve several models. Missing coverage is shown as unavailable. In Python, use api.model(model_id) for detailed capabilities and api.pricing(model_id, online_only=False) for pricing and miner counts. Omit the ID for the full pricing table.

Python

Supply KITANI_API_KEY for inference and KITANI_FINGERPRINT for account or billing operations. The SDK reads environment variables or constructor arguments. The CLI profile is private to the CLI.

from kitani import Kitani

with Kitani() as api:
    catalog = api.models()
    model_id = catalog["data"][0]["id"]  # Choose an available model for your request.
    for chunk in api.stream_chat(model_id, [{"role": "user", "content": "Hello"}]):
        for choice in chunk.get("choices", []):
            print(choice["delta"].get("content") or "", end="", flush=True)

For headless signup, call start_signup(), share only verification_uri_complete and user_code, then call poll_signup(device_code) at the returned interval. Store the approved fingerprint as a secret. Use create_key(name) to mint an inference credential and revoke_key(id) to retire a CLI-issued key.

from kitani import Kitani

with Kitani() as api:
    request_key = api.new_idempotency_key()
    # Persist request_key with your top-up record before sending the request.
    checkout = api.payment_link("10.00", "paypal", idempotency_key=request_key)
    print(checkout["payment_url"])
    print(api.payment(checkout["id"])["status"])

Crypto checkout

Use --via tao or --via sn132 with fund link for Kitani-hosted wallet checkout. The payer connects their extension on the checkout page. To quote and sign in a terminal:

kitani fund link --usd 10 --via tao --json
kitani fund quote PAYMENT_ID --sender PUBLIC_COLDKEY --json
kitani fund pay PAYMENT_ID --wallet WALLET_NAME
kitani fund status PAYMENT_ID --wait

For SN132 ⴵ, supply --hotkey STAKING_HOTKEY_ADDRESS to both quote and pay. Use the same sending coldkey for that link. The quote includes the sender-specific invoice, exact amount, estimated TAO fee, recipient, and block expiry. A plain transfer to the recipient lacks the invoice and may never credit the account. See the agent skill for limits, unattended signing and interrupted payments.

Credentials and output

Credential Purpose
Fingerprint Account and payment management, minting and revoking CLI inference keys
Inference key Authenticated inference against prepaid credit
Verification URL and user code Share with the person authorizing this terminal
Payment URL Share with a payer for one account, amount and payment method

The CLI stores a plaintext SQLite profile in ~/.config/kitani with owner-only file permissions on POSIX systems. Use KITANI_CONFIG_DIR to isolate runners, and secret injection on shared machines. Environment credentials take precedence. A saved inference key is bound to its profile fingerprint. Use kitani login --stdin to import a fingerprint from a pipe. kitani logout clears the local profile. Back up a fingerprint-only account before discarding its last credential.

Add --json to any command. Results go to stdout, diagnostics to stderr. Exit codes are 0 for completion, 1 for other failures, 2 for invalid syntax, 3 for authentication or permission failures, 4 for insufficient credit, 5 for rate limiting, 6 for a wait timeout, and 130 for interruption. A successful status query can report a failed payment. Inspect the status field before treating the invoice as paid.

Development

python -m pip install -e '.[test]'
python -m pytest

The canonical agent instructions are in skills/kitani/SKILL.md. The website serves a copy at /agents/skill.md. Update the mirror when changing the workflow.

Run and monitor an agent

Task Terminal
Find online models with tool calling kitani pricing --online --capability tools --min-context 128000 --sort input-price
Create a budgeted key and inspect spend kitani keys create --name worker --budget-usd 5.00, then kitani keys list
Rotate a CLI-issued secret, keeping its budget and usage history kitani keys rotate KEY_ID --current-fingerprint SHORT_FINGERPRINT (from keys list)
Change an existing CLI key’s lifetime ceiling kitani keys budget KEY_ID --usd 10.00 (or explicitly pass --unlimited)
Read seven days of spend kitani usage --since 7d --by model --json or --by key
Investigate individual requests kitani requests --last 10 --key KEY_ID --since 24h --json
Track deposits across the dashboard and CLI kitani fund history --json and kitani fund status --last --wait
Check which executable and credentials are active python -m kitani.cli doctor --json in the SDK environment
Name and manage authorized devices kitani signup --name build-runner, kitani terminals list, kitani terminals revoke ID

Pass a complete chat payload with kitani chat --request-file request.json --json. Use --request-file - to read JSON from stdin. Include the model ID, messages and any model-supported options such as tools, tool choice or response format. A streaming request produces newline-delimited chunk objects, including tool-call deltas. The Python equivalents are api.chat(model, messages, **options) and api.stream_chat(model, messages, **options).

For an email-free account, run kitani recovery add EMAIL and then kitani recovery verify while you still have the fingerprint. If you lose access, open Kitani’s account recovery page, complete Turnstile and verify the emailed code, then authorize your new terminal against that account. Check other terminals from dashboard settings or with kitani terminals list.

Release to PyPI

  1. Sign in to PyPI Publishing and add a pending GitHub publisher using these exact values.

    Field Value
    PyPI project name kitani
    GitHub owner kitani-inc
    Repository kitani-cli
    Workflow filename release.yml
    Environment pypi
  2. Push the release commit on main. In GitHub Releases, create the tag matching the version in pyproject.toml (currently v0.2.1), target that commit, and select Publish release. The workflow runs when a release is published.

  3. Check the publishing workflow. It runs tests, builds the wheel and source distribution, verifies the tag against the wheel metadata, and publishes with GitHub’s short-lived identity. After it succeeds, verify the version on PyPI and try pipx run --no-cache --spec kitani kitani --version.

  4. For later releases, increment the version in pyproject.toml, push the commit, and publish the matching GitHub release. The verified publisher carries over. The README in the tagged commit supplies the PyPI description for that release.

Metadata

Release files for kitani 0.2.1

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

Source distribution (sdist)

Source distribution for kitani 0.2.1
File Size Uploaded Provenance Actions
kitani-0.2.1.tar.gz 37.6 kB Without provenance Details for kitani-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 61.4 kB

Release files / kitani-0.2.1.tar.gz

Download URL kitani-0.2.1.tar.gz
Size 37.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f9238a4bc5a3886806cdc3d8ec13d4ea31f5ea772ed7e3e5a87449e6b1dc4c4a
BLAKE2b-256 checksum
How to use checksums
4adf4b7c263d262a51c5aba2570943bd3e177bb16dcc03fad37ba547edfc1900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / kitani-0.2.1-py3-none-any.whl

Download URL kitani-0.2.1-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cdbf258dca529c5e0e057d3cc4b6d51d1f024c388c10f33901522b31baee9bf
BLAKE2b-256 checksum
How to use checksums
a80bf940ff0d781b8328876f43190d7ba205b0de45c72b0f215f8a151cf2b05b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Security for kitani 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

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