kitani-cli 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kitani_cli-0.2.0/.github/workflows/release.yml +75 -0
- kitani_cli-0.2.0/.gitignore +8 -0
- kitani_cli-0.2.0/PKG-INFO +149 -0
- kitani_cli-0.2.0/README.md +133 -0
- kitani_cli-0.2.0/pyproject.toml +28 -0
- kitani_cli-0.2.0/skills/kitani/SKILL.md +141 -0
- kitani_cli-0.2.0/src/kitani/__init__.py +5 -0
- kitani_cli-0.2.0/src/kitani/cli.py +624 -0
- kitani_cli-0.2.0/src/kitani/client.py +480 -0
- kitani_cli-0.2.0/src/kitani/profile.py +69 -0
- kitani_cli-0.2.0/src/kitani/py.typed +0 -0
- kitani_cli-0.2.0/src/kitani/updates.py +122 -0
- kitani_cli-0.2.0/src/kitani/wallet.py +192 -0
- kitani_cli-0.2.0/tests/fixtures/finney-498-wallet.scale.gz +0 -0
- kitani_cli-0.2.0/tests/test_cli.py +236 -0
- kitani_cli-0.2.0/tests/test_sdk.py +282 -0
- kitani_cli-0.2.0/tests/test_updates.py +102 -0
- kitani_cli-0.2.0/tests/test_wallet.py +126 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Publish Python distribution
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
outputs:
|
|
13
|
+
published: ${{ steps.registry.outputs.published }}
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- run: python -m pip install build twine '.[test,wallet]'
|
|
20
|
+
- run: python -m pytest -q
|
|
21
|
+
- run: python -m build && python -m twine check dist/*
|
|
22
|
+
- name: Check that the release tag matches the wheel version
|
|
23
|
+
env:
|
|
24
|
+
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
25
|
+
run: |
|
|
26
|
+
python - <<'PY'
|
|
27
|
+
import os, pathlib, zipfile
|
|
28
|
+
from email.parser import BytesParser
|
|
29
|
+
wheel, = pathlib.Path("dist").glob("*.whl")
|
|
30
|
+
with zipfile.ZipFile(wheel) as archive:
|
|
31
|
+
info, = (name for name in archive.namelist() if name.endswith(".dist-info/METADATA"))
|
|
32
|
+
package = BytesParser().parsebytes(archive.read(info))
|
|
33
|
+
if os.environ["RELEASE_TAG"] != "v" + package["Version"]:
|
|
34
|
+
raise SystemExit("Tag must be v followed by the package version")
|
|
35
|
+
PY
|
|
36
|
+
- name: Check for an identical release already on PyPI
|
|
37
|
+
id: registry
|
|
38
|
+
run: |
|
|
39
|
+
python - <<'PY'
|
|
40
|
+
import hashlib, json, os, pathlib, urllib.error, urllib.request
|
|
41
|
+
from importlib.metadata import version
|
|
42
|
+
url = f"https://pypi.org/pypi/kitani-cli/{version('kitani-cli')}/json"
|
|
43
|
+
try:
|
|
44
|
+
with urllib.request.urlopen(url, timeout=15) as response:
|
|
45
|
+
metadata = json.load(response)
|
|
46
|
+
except urllib.error.HTTPError as error:
|
|
47
|
+
if error.code != 404:
|
|
48
|
+
raise
|
|
49
|
+
published = False
|
|
50
|
+
else:
|
|
51
|
+
remote = {f["filename"]: f["digests"]["sha256"] for f in metadata["urls"]}
|
|
52
|
+
local = {f.name: hashlib.sha256(f.read_bytes()).hexdigest() for f in pathlib.Path("dist").iterdir()}
|
|
53
|
+
if remote != local:
|
|
54
|
+
raise SystemExit("PyPI already has this version with different release files")
|
|
55
|
+
published = True
|
|
56
|
+
with open(os.environ["GITHUB_OUTPUT"], "a") as output:
|
|
57
|
+
print(f"published={str(published).lower()}", file=output)
|
|
58
|
+
PY
|
|
59
|
+
- uses: actions/upload-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: distribution
|
|
62
|
+
path: dist/
|
|
63
|
+
publish:
|
|
64
|
+
needs: build
|
|
65
|
+
if: needs.build.outputs.published != 'true'
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
environment: pypi
|
|
68
|
+
permissions:
|
|
69
|
+
id-token: write
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/download-artifact@v4
|
|
72
|
+
with:
|
|
73
|
+
name: distribution
|
|
74
|
+
path: dist/
|
|
75
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: kitani-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python SDK and agent-first CLI for Kitani inference and prepaid billing
|
|
5
|
+
Project-URL: Repository, https://github.com/kitani-inc/kitani-cli
|
|
6
|
+
Project-URL: Documentation, https://kitani.ai/agents
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: httpx<1,>=0.27
|
|
9
|
+
Requires-Dist: packaging>=24
|
|
10
|
+
Provides-Extra: test
|
|
11
|
+
Requires-Dist: pytest<10,>=8; extra == 'test'
|
|
12
|
+
Provides-Extra: wallet
|
|
13
|
+
Requires-Dist: bittensor-wallet<5,>=4; extra == 'wallet'
|
|
14
|
+
Requires-Dist: substrate-interface<2,>=1.7; extra == 'wallet'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Kitani CLI and Python SDK
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
[Agents](https://kitani.ai/agents) · [Agent skill](https://github.com/kitani-inc/kitani-cli/blob/main/skills/kitani/SKILL.md) · [API documentation](https://kitani.ai/docs/agents)
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Requires Python 3.10 or later. Install the released CLI from PyPI with pipx:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pipx install kitani-cli
|
|
29
|
+
kitani --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For the Python SDK, run `python -m pip install kitani-cli` in your virtual environment. For local wallet signing, install `'kitani-cli[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.
|
|
33
|
+
|
|
34
|
+
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-cli`. JSON output, redirected streams, CI, and `doctor --offline` skip the check. Set `KITANI_NO_UPDATE_CHECK=1` to disable it.
|
|
35
|
+
|
|
36
|
+
## First inference request
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
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.
|
|
40
|
+
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`.
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
## Model catalog and pricing
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
kitani models # list model IDs
|
|
47
|
+
kitani models qwen/qwen3.8-27b-uncensored --json
|
|
48
|
+
kitani pricing --online # rates and reported online miners
|
|
49
|
+
kitani pricing qwen/qwen3.8-27b-uncensored --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
## Python
|
|
55
|
+
|
|
56
|
+
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.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from kitani import Kitani
|
|
60
|
+
|
|
61
|
+
with Kitani() as api:
|
|
62
|
+
catalog = api.models()
|
|
63
|
+
model_id = catalog["data"][0]["id"] # Choose an available model for your request.
|
|
64
|
+
for chunk in api.stream_chat(model_id, [{"role": "user", "content": "Hello"}]):
|
|
65
|
+
for choice in chunk.get("choices", []):
|
|
66
|
+
print(choice["delta"].get("content") or "", end="", flush=True)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from kitani import Kitani
|
|
73
|
+
|
|
74
|
+
with Kitani() as api:
|
|
75
|
+
request_key = api.new_idempotency_key()
|
|
76
|
+
# Persist request_key with your top-up record before sending the request.
|
|
77
|
+
checkout = api.payment_link("10.00", "paypal", idempotency_key=request_key)
|
|
78
|
+
print(checkout["payment_url"])
|
|
79
|
+
print(api.payment(checkout["id"])["status"])
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Crypto checkout
|
|
83
|
+
|
|
84
|
+
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:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
kitani fund link --usd 10 --via tao --json
|
|
88
|
+
kitani fund quote PAYMENT_ID --sender PUBLIC_COLDKEY --json
|
|
89
|
+
kitani fund pay PAYMENT_ID --wallet WALLET_NAME
|
|
90
|
+
kitani fund status PAYMENT_ID --wait
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
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](https://github.com/kitani-inc/kitani-cli/blob/main/skills/kitani/SKILL.md) for limits, unattended signing and interrupted payments.
|
|
94
|
+
|
|
95
|
+
## Credentials and output
|
|
96
|
+
|
|
97
|
+
| Credential | Purpose |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| Fingerprint | Account and payment management, minting and revoking CLI inference keys |
|
|
100
|
+
| Inference key | Authenticated inference against prepaid credit |
|
|
101
|
+
| Verification URL and user code | Share with the person authorizing this terminal |
|
|
102
|
+
| Payment URL | Share with a payer for one account, amount and payment method |
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
python -m pip install -e '.[test]'
|
|
112
|
+
python -m pytest
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
## Run and monitor an agent
|
|
118
|
+
|
|
119
|
+
| Task | Terminal |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| Find online models with tool calling | `kitani pricing --online --capability tools --min-context 128000 --sort input-price` |
|
|
122
|
+
| Create a budgeted key and inspect spend | `kitani keys create --name worker --budget-usd 5.00`, then `kitani keys list` |
|
|
123
|
+
| Rotate a CLI-issued secret, keeping its budget and usage history | `kitani keys rotate KEY_ID --current-fingerprint SHORT_FINGERPRINT` (from `keys list`) |
|
|
124
|
+
| Change an existing CLI key’s lifetime ceiling | `kitani keys budget KEY_ID --usd 10.00` (or explicitly pass `--unlimited`) |
|
|
125
|
+
| Read seven days of spend | `kitani usage --since 7d --by model --json` or `--by key` |
|
|
126
|
+
| Investigate individual requests | `kitani requests --last 10 --key KEY_ID --since 24h --json` |
|
|
127
|
+
| Track deposits across the dashboard and CLI | `kitani fund history --json` and `kitani fund status --last --wait` |
|
|
128
|
+
| Check which executable and credentials are active | `python -m kitani.cli doctor --json` in the SDK environment |
|
|
129
|
+
| Name and manage authorized devices | `kitani signup --name build-runner`, `kitani terminals list`, `kitani terminals revoke ID` |
|
|
130
|
+
|
|
131
|
+
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)`.
|
|
132
|
+
|
|
133
|
+
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](https://kitani.ai/cli/recover), 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`.
|
|
134
|
+
|
|
135
|
+
## Release to PyPI
|
|
136
|
+
|
|
137
|
+
1. Sign in to [PyPI Publishing](https://pypi.org/manage/account/publishing/) and add a pending **GitHub** publisher using these exact values.
|
|
138
|
+
|
|
139
|
+
| Field | Value |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| PyPI project name | `kitani-cli` |
|
|
142
|
+
| GitHub owner | `kitani-inc` |
|
|
143
|
+
| Repository | `kitani-cli` |
|
|
144
|
+
| Workflow filename | `release.yml` |
|
|
145
|
+
| Environment | `pypi` |
|
|
146
|
+
|
|
147
|
+
2. Push the release commit on `main`. In [GitHub Releases](https://github.com/kitani-inc/kitani-cli/releases/new), create the tag matching the version in `pyproject.toml` (currently `v0.2.0`), target that commit, and select **Publish release**. The workflow runs when a release is published.
|
|
148
|
+
3. Check the [publishing workflow](https://github.com/kitani-inc/kitani-cli/actions/workflows/release.yml). 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](https://pypi.org/project/kitani-cli/) and try `pipx run --no-cache --spec kitani-cli kitani --version`.
|
|
149
|
+
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.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Kitani CLI and Python SDK
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
[Agents](https://kitani.ai/agents) · [Agent skill](https://github.com/kitani-inc/kitani-cli/blob/main/skills/kitani/SKILL.md) · [API documentation](https://kitani.ai/docs/agents)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Requires Python 3.10 or later. Install the released CLI from PyPI with pipx:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pipx install kitani-cli
|
|
13
|
+
kitani --version
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For the Python SDK, run `python -m pip install kitani-cli` in your virtual environment. For local wallet signing, install `'kitani-cli[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.
|
|
17
|
+
|
|
18
|
+
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-cli`. JSON output, redirected streams, CI, and `doctor --offline` skip the check. Set `KITANI_NO_UPDATE_CHECK=1` to disable it.
|
|
19
|
+
|
|
20
|
+
## First inference request
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
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.
|
|
24
|
+
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`.
|
|
25
|
+
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.
|
|
26
|
+
|
|
27
|
+
## Model catalog and pricing
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
kitani models # list model IDs
|
|
31
|
+
kitani models qwen/qwen3.8-27b-uncensored --json
|
|
32
|
+
kitani pricing --online # rates and reported online miners
|
|
33
|
+
kitani pricing qwen/qwen3.8-27b-uncensored --json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
## Python
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from kitani import Kitani
|
|
44
|
+
|
|
45
|
+
with Kitani() as api:
|
|
46
|
+
catalog = api.models()
|
|
47
|
+
model_id = catalog["data"][0]["id"] # Choose an available model for your request.
|
|
48
|
+
for chunk in api.stream_chat(model_id, [{"role": "user", "content": "Hello"}]):
|
|
49
|
+
for choice in chunk.get("choices", []):
|
|
50
|
+
print(choice["delta"].get("content") or "", end="", flush=True)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from kitani import Kitani
|
|
57
|
+
|
|
58
|
+
with Kitani() as api:
|
|
59
|
+
request_key = api.new_idempotency_key()
|
|
60
|
+
# Persist request_key with your top-up record before sending the request.
|
|
61
|
+
checkout = api.payment_link("10.00", "paypal", idempotency_key=request_key)
|
|
62
|
+
print(checkout["payment_url"])
|
|
63
|
+
print(api.payment(checkout["id"])["status"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Crypto checkout
|
|
67
|
+
|
|
68
|
+
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:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
kitani fund link --usd 10 --via tao --json
|
|
72
|
+
kitani fund quote PAYMENT_ID --sender PUBLIC_COLDKEY --json
|
|
73
|
+
kitani fund pay PAYMENT_ID --wallet WALLET_NAME
|
|
74
|
+
kitani fund status PAYMENT_ID --wait
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
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](https://github.com/kitani-inc/kitani-cli/blob/main/skills/kitani/SKILL.md) for limits, unattended signing and interrupted payments.
|
|
78
|
+
|
|
79
|
+
## Credentials and output
|
|
80
|
+
|
|
81
|
+
| Credential | Purpose |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Fingerprint | Account and payment management, minting and revoking CLI inference keys |
|
|
84
|
+
| Inference key | Authenticated inference against prepaid credit |
|
|
85
|
+
| Verification URL and user code | Share with the person authorizing this terminal |
|
|
86
|
+
| Payment URL | Share with a payer for one account, amount and payment method |
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
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.
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
python -m pip install -e '.[test]'
|
|
96
|
+
python -m pytest
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
## Run and monitor an agent
|
|
102
|
+
|
|
103
|
+
| Task | Terminal |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| Find online models with tool calling | `kitani pricing --online --capability tools --min-context 128000 --sort input-price` |
|
|
106
|
+
| Create a budgeted key and inspect spend | `kitani keys create --name worker --budget-usd 5.00`, then `kitani keys list` |
|
|
107
|
+
| Rotate a CLI-issued secret, keeping its budget and usage history | `kitani keys rotate KEY_ID --current-fingerprint SHORT_FINGERPRINT` (from `keys list`) |
|
|
108
|
+
| Change an existing CLI key’s lifetime ceiling | `kitani keys budget KEY_ID --usd 10.00` (or explicitly pass `--unlimited`) |
|
|
109
|
+
| Read seven days of spend | `kitani usage --since 7d --by model --json` or `--by key` |
|
|
110
|
+
| Investigate individual requests | `kitani requests --last 10 --key KEY_ID --since 24h --json` |
|
|
111
|
+
| Track deposits across the dashboard and CLI | `kitani fund history --json` and `kitani fund status --last --wait` |
|
|
112
|
+
| Check which executable and credentials are active | `python -m kitani.cli doctor --json` in the SDK environment |
|
|
113
|
+
| Name and manage authorized devices | `kitani signup --name build-runner`, `kitani terminals list`, `kitani terminals revoke ID` |
|
|
114
|
+
|
|
115
|
+
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)`.
|
|
116
|
+
|
|
117
|
+
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](https://kitani.ai/cli/recover), 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`.
|
|
118
|
+
|
|
119
|
+
## Release to PyPI
|
|
120
|
+
|
|
121
|
+
1. Sign in to [PyPI Publishing](https://pypi.org/manage/account/publishing/) and add a pending **GitHub** publisher using these exact values.
|
|
122
|
+
|
|
123
|
+
| Field | Value |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| PyPI project name | `kitani-cli` |
|
|
126
|
+
| GitHub owner | `kitani-inc` |
|
|
127
|
+
| Repository | `kitani-cli` |
|
|
128
|
+
| Workflow filename | `release.yml` |
|
|
129
|
+
| Environment | `pypi` |
|
|
130
|
+
|
|
131
|
+
2. Push the release commit on `main`. In [GitHub Releases](https://github.com/kitani-inc/kitani-cli/releases/new), create the tag matching the version in `pyproject.toml` (currently `v0.2.0`), target that commit, and select **Publish release**. The workflow runs when a release is published.
|
|
132
|
+
3. Check the [publishing workflow](https://github.com/kitani-inc/kitani-cli/actions/workflows/release.yml). 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](https://pypi.org/project/kitani-cli/) and try `pipx run --no-cache --spec kitani-cli kitani --version`.
|
|
133
|
+
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.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25,<2"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kitani-cli"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Python SDK and agent-first CLI for Kitani inference and prepaid billing"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = ["httpx>=0.27,<1", "packaging>=24"]
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Repository = "https://github.com/kitani-inc/kitani-cli"
|
|
15
|
+
Documentation = "https://kitani.ai/agents"
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
kitani = "kitani.cli:main"
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
wallet = ["bittensor-wallet>=4,<5", "substrate-interface>=1.7,<2"]
|
|
22
|
+
test = ["pytest>=8,<10"]
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build.targets.wheel]
|
|
25
|
+
packages = ["src/kitani"]
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kitani
|
|
3
|
+
description: Use the Kitani CLI or Python SDK to authorize a terminal, manage inference keys, list models, stream inference, quote TAO or SN132 alpha, create prepaid checkout links, and verify settlement. Use for agents building or running workflows against the Kitani inference API.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kitani for agents
|
|
7
|
+
|
|
8
|
+
Kitani sells prepaid inference. A fingerprint controls an account, an inference key spends its available balance, and a payment link allows a payer to fund one particular account. Keep the user's existing account whenever they want to spend its balance.
|
|
9
|
+
|
|
10
|
+
## Choose your entry point
|
|
11
|
+
|
|
12
|
+
| What you have | First action |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| The user needs the public model catalog | Run `kitani models --json`. Public reads need no signup. |
|
|
15
|
+
| An inference key supplied through a secret store | Inject `KITANI_API_KEY` and call the model. |
|
|
16
|
+
| A fingerprint or a configured runner | Use `KITANI_FINGERPRINT` or the saved profile. Run `kitani whoami --json` to check the beneficiary before funding. |
|
|
17
|
+
| An existing Kitani account on another device | Start CLI signup and have the owner select their existing account in the browser. This terminal will use the same balance. |
|
|
18
|
+
| A user wants a new email-less account | Start fingerprint signup. A person completes Turnstile on kitani.ai. The new account starts at zero. |
|
|
19
|
+
| A checkout is already in progress | Resume using the existing payment ID. Check its status before initiating another payment. |
|
|
20
|
+
|
|
21
|
+
Install the published CLI with `pipx install kitani-cli` and update with `pipx upgrade kitani-cli`. For the development version, install from GitHub with `pipx install 'git+https://github.com/kitani-inc/kitani-cli.git'`. From a local checkout use `pipx install .`. Use `kitani --help` and subcommand help for the installed interface. If an older program owns the kitani command, check with `kitani fund --help`. In the virtual environment containing this SDK, `python -m kitani.cli` invokes the correct CLI. In Python import `Kitani` from `kitani`. The base package supports inference, checkout links and browser wallets. Local coldkey signing requires the wallet extra.
|
|
22
|
+
|
|
23
|
+
## Authorize one terminal
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
kitani signup --no-browser --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Give the person the returned **verification_url** and **user_code**. Ask them to compare the code, choose fingerprint signup or their existing account, and complete Turnstile. They can close the tab when Kitani confirms approval. The terminal that started signup claims the credential:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
kitani signup --resume --json
|
|
33
|
+
kitani whoami --json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Resume in the **same profile directory**. A disconnect during approval does not require another signup. Approval lasts ten minutes. The SDK’s `poll_signup` reports pending until approval; wait the advertised interval, normally five seconds. Start a fresh authorization when the grant expires. Interactive terminals can run `kitani signup`.
|
|
37
|
+
|
|
38
|
+
The fingerprint is the account login secret. Save it in a secret manager before destroying a runner, especially for an account with no email. `kitani keys export fingerprint` deliberately emits the raw credential. Direct it into private storage. Avoid recording secrets in conversation, CI logs or shell tracing. `kitani login --stdin` accepts an existing fingerprint through a pipe. Set `KITANI_CONFIG_DIR` to isolate projects. Local logout removes saved credentials. Server credentials remain active until revoked.
|
|
39
|
+
|
|
40
|
+
## Choose a model and check its price
|
|
41
|
+
|
|
42
|
+
Run `kitani pricing --online --json` to see models with reported online miners. For one model, run `kitani pricing MODEL_ID --json`: the matching row includes input, output and cache prices in USD per million tokens, per-image pricing where applicable, context length and miner count. `totalMiners` counts distinct online miners across the network. A null count means coverage data was unavailable; zero means no online miners reported that model. Run `kitani models MODEL_ID --json` for capabilities and the model’s API contract. These reads are public.
|
|
43
|
+
|
|
44
|
+
## Call inference
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
kitani keys create --name inference-worker --json
|
|
48
|
+
kitani models --json
|
|
49
|
+
kitani chat --model MODEL_ID "Respond in one sentence." --json
|
|
50
|
+
kitani chat --model MODEL_ID "Respond in one sentence." --stream --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Create a key when the task needs one. The command saves it and prints its record ID and identifying metadata. Keep that ID for `kitani keys revoke KEY_ID`. Select an actual API model ID from the current catalog. Nonstreaming JSON is an OpenAI-compatible completion. Streaming JSON mode emits one object per line; incremental text is in `choices[].delta.content`. Tool call and usage chunks can contain no text. A timeout after an inference POST can still correspond to a billable request.
|
|
54
|
+
|
|
55
|
+
In Python reuse one `Kitani` context across requests. Use `chat` for a complete response and `stream_chat` for an iterator. Neither method silently resubmits ambiguous inference requests. An inference key cannot mint account credentials or create payment links.
|
|
56
|
+
|
|
57
|
+
## Give a payer a checkout link
|
|
58
|
+
|
|
59
|
+
Record the authorized USD amount, payment method and a stable idempotency key before creating a top-up. Use 16–128 letters, digits, periods, colons, underscores or hyphens per unique payment request. Retry with the same amount, method and key if the response is lost.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
# Generate once per intended top-up. Persist this ID with the order before calling Kitani.
|
|
63
|
+
request_id=$(python3 -c 'import uuid; print(uuid.uuid4())')
|
|
64
|
+
kitani fund link --usd 10.00 --via paypal --idempotency-key "$request_id" --json
|
|
65
|
+
kitani fund status PAYMENT_ID --json
|
|
66
|
+
kitani fund status PAYMENT_ID --wait --timeout 180 --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Return the exact **payment_url** to the intended payer, including its hash fragment. Keep **id** for status queries. The link fixes the beneficiary, method and USD amount. The payer never needs the fingerprint. For PayPal they open Kitani checkout and approve at PayPal. For a browser wallet choose `--via tao` or `--via sn132`; the payer connects their wallet on Kitani and reviews the transaction there. Creating a link does not charge anyone. An agent without a wallet should share the existing link and check status. It can skip the quote and sign commands.
|
|
70
|
+
|
|
71
|
+
A PayPal session already opened can settle even after link expiry. Check the original order before replacing it. Each link accepts USD 5.00–1,000.00 and expires after thirty minutes. `amount_cents` is the credit requested; `charge_cents` is the checkout charge. If the payer changes the method or amount, create a new request with a new key. Creating another link merely because confirmation is delayed can result in two independently payable requests.
|
|
72
|
+
|
|
73
|
+
## Quote and pay crypto from a terminal
|
|
74
|
+
|
|
75
|
+
1. Create a link using TAO or SN132 ⴵ. Identify the sending coldkey. For ⴵ also identify the public hotkey holding that coldkey’s SN132 stake.
|
|
76
|
+
2. Request a quote with that wallet. The first quote binds the link to the sender and staking hotkey. The API calls SN132 ⴵ `alpha`.
|
|
77
|
+
3. Review the amount, estimated fee, recipient and block expiry. A quote expires sooner than its hosted link. Sign the invoice-bound payment through the supported flow. A plain transfer to the displayed recipient lacks the invoice reference.
|
|
78
|
+
4. Poll the payment ID through settlement. Give the payer the final status and transaction hash when available.
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
kitani fund quote PAYMENT_ID --sender PUBLIC_COLDKEY --json
|
|
82
|
+
kitani fund pay PAYMENT_ID --wallet LOCAL_WALLET_NAME
|
|
83
|
+
kitani fund status PAYMENT_ID --wait --json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For SN132, add `--hotkey PUBLIC_STAKING_HOTKEY` to quote and pay. The quote’s `amount` is the human-readable token amount and `units` is its integer base-unit amount (1 billion per token). `fee_tao` and `fee` give the estimated network fee in TAO and RAO respectively. The wallet signs on Finney mainnet. Its coldkey stays local. Never ask a user for a seed phrase or wallet file.
|
|
87
|
+
|
|
88
|
+
Unattended signing requires a payment ID, `--yes`, `--max-units` and `--max-fee-rao`. Derive both bounds from the authorized spending instruction and inspected quote. The fee limit applies to the current fee estimate; chain fees can change before inclusion. If a limit is exceeded, let the user decide whether to change it. For a user-owned wallet, sending the hosted link is usually simpler.
|
|
89
|
+
|
|
90
|
+
## Interpret the result
|
|
91
|
+
|
|
92
|
+
| Status | Agent action |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| pending | The link exists. Give it to the payer or let the existing checkout finish. |
|
|
95
|
+
| quoted | A sender-specific quote exists. Check expiry and wallet identity before signing. |
|
|
96
|
+
| submitted | A signed transaction is in flight. Poll this payment ID. |
|
|
97
|
+
| paid | Kitani has credited the account. Use `kitani balance --json` for the current balance. |
|
|
98
|
+
| failed or expired | Check the transaction and payment history before creating a replacement. |
|
|
99
|
+
| refunded or partially_refunded | Report the status. Use the current balance for spending decisions. |
|
|
100
|
+
|
|
101
|
+
A successful command exit means the status query succeeded. Only `paid` confirms that particular top-up. Exit 6 while waiting means the terminal reached its timeout. Resume with the same ID. After a connection loss while submitting a signature or capturing PayPal, query status first. A balance comparison alone is inconclusive because inference may be spending concurrently.
|
|
102
|
+
|
|
103
|
+
## Rate limits and failures
|
|
104
|
+
|
|
105
|
+
Honor HTTP 429 and its integer `Retry-After` in seconds. Pause parallel attempts sharing the limited IP or account. Device start and approval each allow 5 attempts per IP per 15 minutes and 20 per day. Pending polls are limited to once per grant per five seconds and 30 per IP per minute. Fingerprint endpoints share 120 requests per account per minute. CLI key creation allows 5 per account per hour; new payment links allow 10 per account per hour. Other authentication, network and model limits can apply simultaneously. Read the [public limits](https://kitani.ai/docs/agents#limits) before planning high-volume jobs.
|
|
106
|
+
|
|
107
|
+
Exit 3 indicates missing credentials or denied access. Check whether the operation needs a fingerprint or an inference key. Exit 4 means insufficient funded credit. Exit 5 is rate limiting. Exit 1 covers other failures and exit 2 invalid syntax. Only start another authorization when the previous one expires or the credential is lost, revoked, or belongs to the wrong account.
|
|
108
|
+
|
|
109
|
+
## Direct API integration
|
|
110
|
+
|
|
111
|
+
Use `https://api.kitani.ai/v1` as the API base. Call `POST /cli/device/start` with an empty object. Keep `device_code` private. Share the returned verification URL and user code. Poll `POST /cli/device/token` with the device code. HTTP 202 means pending. On approval save the returned fingerprint. The website completes human verification. An SDK client never needs a Turnstile secret.
|
|
112
|
+
|
|
113
|
+
Send the fingerprint as a bearer token to `GET /cli/account`, `POST /cli/keys`, `DELETE /cli/keys/{id}` and the CLI payment endpoints. Use an inference key on `POST /chat/completions`. Creating a checkout uses `POST /cli/payments` with `method` (paypal, tao or alpha), integer `amount_cents`, and `idempotency_key`. Read `GET /cli/payments/{id}` for settlement. Crypto uses `POST /cli/payments/{id}/quote` with sender and optional staking hotkey, then `POST /cli/payments/{id}/submit` with quote ID and the verified payload’s local signature. Prefer the SDK’s terminal command or the hosted extension flow for signing.
|
|
114
|
+
|
|
115
|
+
## Operate a long-running agent
|
|
116
|
+
|
|
117
|
+
1. Run `python -m kitani.cli doctor --json` inside the installed environment if a shell resolves a different `kitani` executable. Check the Python path, invoked file, PATH match, profile, and credential sources. `--offline` skips the account lookup. An inference key alone can call inference but cannot identify or administer the account.
|
|
118
|
+
2. Label a new device with `kitani signup --name BUILD_RUNNER`. Before funding an email-free account, offer `kitani recovery add EMAIL`. The owner reads their code from email and runs `kitani recovery verify`, or pipes the code into `kitani recovery verify --stdin`. Complete enrollment within ten minutes in the same private profile. Check `kitani recovery status`. For a lost fingerprint, direct the owner to [recover their account](https://kitani.ai/cli/recover) before authorizing a replacement terminal. List existing devices with `kitani terminals list --json` and revoke the identified terminal by its ID.
|
|
119
|
+
3. Give each workload a named key. Use `kitani keys create --name WORKLOAD --budget-usd 5.00 --json` with the owner's intended maximum lifetime spend. `kitani keys list --json` returns records, spend, and limits. A key's ceiling and the account's prepaid balance both apply. Use `kitani keys budget KEY_ID --usd 10.00` to update a CLI-issued key when the owner authorizes a new limit. Zero pauses spending. Removing the ceiling requires the explicit `--unlimited` flag. To replace a CLI key’s secret, take its short public fingerprint from `keys list` and run `kitani keys rotate KEY_ID --current-fingerprint SHORT_FINGERPRINT`. This selects the replacement as the profile’s active inference key and keeps the existing spend, history, and budget. If the short fingerprint is stale, list keys again and check which runner is using it. Check both when a funded account gets an insufficient-credit error.
|
|
120
|
+
4. Discover eligible models with `kitani pricing --online --capability tools --min-context 128000 --sort input-price --json`. The first row is cheapest by input price among matches; output, cache and image units are separate. Real historical p50 latency includes the whole request, and throughput counts output tokens per elapsed second. Unavailable measurements remain null. Use `api.performance()` to read the sample size and measurement window directly.
|
|
121
|
+
5. Send a structured payload with `kitani chat --request-file - --json < request.json`. Supply normal chat fields in the JSON object, including a model and a nonempty array of messages. On tool-capable models, use `tools` and `tool_choice`; inspect returned tool calls before dispatching them. `stream: true` emits one JSON object per line, including tool deltas and usage. Preserve the complete response for your application.
|
|
122
|
+
6. Read `kitani usage --since 7d --by key --json` for totals, or `--by model`. Query recent request IDs and charges with `kitani requests --last 10 --since 24h --model MODEL_ID --key KEY_ID --json`. For a stable multi-page time range, pass a fixed ISO start time. Pass `next_cursor` verbatim to `--cursor` with the same filters until it is null.
|
|
123
|
+
7. Check completed and pending funding from all channels with `kitani fund history --last 20 --json`. Read or wait for the most recent payment with `kitani fund status --last --wait --json`. If several checkouts overlap, pass the original payment ID. A query with no payments returns `status: no_payments`.
|
|
124
|
+
|
|
125
|
+
Fingerprint-authenticated read routes are `GET /cli/keys`, `/cli/usage`, `/cli/requests`, `/cli/payments`, `/cli/recovery/email` and `/cli/terminals`, relative to the API base above. Use `group_by` for usage and `limit` for paged lists (1–100). Python exposes `keys()`, `usage(since=..., group_by=...)`, `requests(limit=..., key_id=..., model=..., cursor=...)`, `payment_history()`, and `terminals()`. A dashboard session uses `/account/reports/{keys,usage,requests,payments}`. A fingerprint and an inference key have different authority. The public network performance endpoint is `GET /network/performance`.
|
|
126
|
+
|
|
127
|
+
### Dashboard session API reference
|
|
128
|
+
|
|
129
|
+
These existing browser endpoints share the same API base. Use a dashboard session for account settings and role-based workspace or provider operations. For a terminal, use the fingerprint and inference operations above. Keep the dashboard cookie in its browser.
|
|
130
|
+
|
|
131
|
+
| Dashboard task | HTTP operation |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| Overview, balance and usage | `GET /account`, `GET /account/usage` |
|
|
134
|
+
| Request diagnostics | `GET /account/requests`, `GET /account/requests/{id}` |
|
|
135
|
+
| Usage export | `GET /account/usage/export?start=YYYY-MM-DD&end=YYYY-MM-DD`; end is exclusive, at most 32 days |
|
|
136
|
+
| Update a key's budget | `PATCH /account/api-keys/{id}/usage-limit` with `usage_limit_usd` |
|
|
137
|
+
| Read a deposit receipt | `GET /billing/deposits/{deposit_id}/receipt` |
|
|
138
|
+
| Notification and residence settings | `GET` or `POST /account/notifications` and `/account/residence` |
|
|
139
|
+
| Billing preferences and refill | `GET /billing/preferences`, `POST /billing/auto-refill` |
|
|
140
|
+
| Workspaces and project access | `GET` or `POST /account/workspaces`, `GET /account/workspaces/{org}`; project, invitation, key, member and webhook operations live under the workspace |
|
|
141
|
+
| Provider activity and withdrawals | `GET /account/provider/activity`, `POST /account/withdrawals` for eligible provider accounts |
|