kiapi
English | 日本語
Summary
kiapi is a local API server that uses Apple Silicon and MLX to provide generative AI capabilities for LLM agents.
API
| Domain | Family | Endpoint | Description |
|---|---|---|---|
| chat | POST /v1/chat |
Chat API details | |
| embedding | POST /v1/embedding |
Embedding API details | |
| image | zimage | POST /v1/image/zimage |
Z-Image API details |
| flux2 | POST /v1/image/flux2 |
FLUX.2 API details | |
| qwen | POST /v1/image/qwen |
Qwen Image API details | |
| ideogram4 | POST /v1/image/ideogram4 |
Ideogram 4 API details | |
| ernie | POST /v1/image/ernie |
ERNIE-Image API details | |
| seedvr2 | POST /v1/image/seedvr2 |
SeedVR2 API details | |
| depthpro | POST /v1/image/depthpro |
Depth Pro API details | |
| audio | acestep | POST /v1/audio/acestep |
ACE-Step API details |
| audiogen | POST /v1/audio/audiogen |
AudioGen API details | |
| video | ltx2 | POST /v1/video/ltx2 |
LTX-2 API details |
| web | POST /v1/web |
Web API details | |
| core | files | POST /v1/files |
Upload input files, LoRA adapters, and other files, then issue a file_id. |
GET /v1/files |
Return a list of stored files. | ||
GET /v1/files/{file_id} |
Return file metadata. | ||
GET /v1/files/{file_id}/download |
Download the file body. | ||
DELETE /v1/files/{file_id} |
Delete a stored file. | ||
| jobs | GET /v1/jobs |
Return a list of generation jobs. | |
GET /v1/jobs/{job_id} |
Return job status, progress, result, and artifact file_ids. |
||
DELETE /v1/jobs/{job_id} |
Remove a job from the job store. Running jobs are not interrupted. | ||
| openapi | GET /openapi.json |
Return the common API and each capability documentation URL. | |
GET /v1/{domain}/{family}/openapi.json |
Return detailed input/output specs, usage, tips, and examples for each family. | ||
| health | GET /health |
Return server status, warmup status, queue length, and memory usage. |
See: kiapi API Docs
Requirements
- macOS / Apple Silicon
- Python
>=3.12,<3.13 uv(optional, recommended for isolated CLI installs and faster venv/package setup inkiapi activate)mise(used for development)- Docker (when using the Web capability)
- Enough disk capacity for model weights and Docker images
kiapi is developed mainly for personal use on a Mac Studio M4 Max 128GB. Some or all features may work on other Apple Silicon environments, but they are not the primary verification target.
The memory budget can be specified with KIAPI_MEMORY_LIMIT_GB. If omitted,
kiapi automatically uses 80% of installed memory as the effective budget on
startup. If a model's required memory does not fit in that budget, requests
return 503 as an insufficient memory budget error.
kiapi activate --all uses a little under 600GB of disk capacity, including
model weights and Docker images. At first, it is recommended to use kiapi activate
to set up only the capabilities you need.
Remote Job Relay
The optional GCP relay lets a kiapi node inside a closed network receive API
work without exposing an inbound socket. Firebase Realtime Database carries
small notifications, while Cloud Storage carries request and response bodies.
Install kiapi with the relay-gcp extra to enable it:
python3.12 -m pip install --upgrade "kiapi[relay-gcp]"
uv tool install --python 3.12 "kiapi[relay-gcp]"
export KIAPI_RELAY_GCP_DATABASE_URL="https://PROJECT.firebaseio.com"
export KIAPI_RELAY_GCP_BUCKET="PRIVATE_RELAY_BUCKET"
# Uses Application Default Credentials by default.
kiapi run --relay gcp
Each node generates its own node_id on first start, persists it in the user
data directory, and publishes a liveness heartbeat under liveness.
A requester picks the most recently seen node and writes
sessions/{session_id}/request.json in GCS, then writes a notification
to nodes/{node_id}/requests/{session_id} in RTDB. The relay reports
queued, running, and the terminal result below the requester node's
responses path.
- Requests are dispatched directly to the in-process FastAPI app and handled one at a time by the relay.
- JSON responses use
response.json. Binary responses writeresponse.bodybeforeresponse.json. response.jsonuses a GCS create-only generation precondition. A completed response found after restart is reported without executing the API again.- The terminal RTDB response and request deletion use one atomic multi-location update.
- Startup installs a session-scoped lifecycle rule that deletes session objects
after one day. Set
KIAPI_RELAY_GCP_MANAGE_BUCKET_LIFECYCLE=falsewhen infrastructure manages this rule.
Use a dedicated bucket and narrowly scoped RTDB/GCS permissions. Google
credentials are configured through
kiarina-lib-google.
See GCP Relay setup for resource creation, IAM, authentication, configuration, and verification steps.
For local relay verification without GCP, use local. It uses the same
in-process dispatch path but stores notifications and payloads under a local
directory:
export KIAPI_RELAY_LOCAL_ROOT="/tmp/kiapi/relay"
export KIAPI_RELAY_LOCAL_PREFIX="private/kiapi"
kiapi run --relay local
The requester writes {root}/{prefix}/sessions/{session_id}/request.json, then
writes {root}/{prefix}/nodes/{node_id}/requests/{session_id}.json with
{"session_id":"...","source_node_id":"..."}. The relay writes bridge status
to {root}/{prefix}/nodes/{source_node_id}/responses/{session_id}.json and
stores the committed response in the session directory.
Local Storage
kiapi mainly writes to these local paths at runtime.
| Purpose | Setting | Default | Notes |
|---|---|---|---|
| Files API uploads, generated artifacts, and URL/data URL inputs | KIAPI_FILES_ROOT |
/tmp/kiapi/files |
Storage referenced by file_id. The default may disappear after OS reboot or tmp cleanup. Use ~/.kiapi/files or external storage for long-term retention. |
| Temporary working directories during request processing | KIAPI_TMP_ROOT |
/tmp/kiapi/work |
Used for chat/embedding input expansion, generation intermediates, LoRA training work, and similar tasks. |
| Web backend subprocess logs | KIAPI_WEB_BACKEND_LOG_DIR |
/tmp/kiapi/logs/web |
stdout/stderr for SearXNG / Crawl4AI Docker subprocesses. |
| ACE-Step dedicated venv / project / checkpoints | KIAPI_ACESTEP_PYTHON_PATH, KIAPI_ACESTEP_PROJECT_ROOT, KIAPI_ACESTEP_CHECKPOINT_DIR |
acestep/ under the user data dir |
When python_path, project_root, and checkpoint_dir are omitted, kiapi places the ACE-Step venv and checkpoints under a persistent ACE-Step directory. |
Other model weights and library caches are managed by Hugging Face, mflux, Docker, or each library/tool. kiapi generally does not move them into its own storage location.
Security
By default, kiapi run starts on 127.0.0.1:8000.
When --host 0.0.0.0 is specified, the server may be reachable from other
machines, so use it only on trusted networks.
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 kiapi-0.5.2.tar.gz.
File metadata
- Download URL: kiapi-0.5.2.tar.gz
- Upload date:
- Size: 262.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e7a57da87acf7f87c9dc85df33063cf783e667b59a62840657ab2232b28390a
|
|
| MD5 |
dc0b0f2f9ccad19fe214425b98d6c7ea
|
|
| BLAKE2b-256 |
42fa04b09d15aaa8bbcde045e23a2b1a1a7399c3fcf6a18149488a09718318d1
|
Provenance
The following attestation bundles were made for kiapi-0.5.2.tar.gz:
Publisher:
release-pypi.yml on kiarina/kiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiapi-0.5.2.tar.gz -
Subject digest:
8e7a57da87acf7f87c9dc85df33063cf783e667b59a62840657ab2232b28390a - Sigstore transparency entry: 2280343543
- Sigstore integration time:
-
Permalink:
kiarina/kiapi@53b4abf894caa44be2a1b6256eb4030a94172259 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/kiarina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@53b4abf894caa44be2a1b6256eb4030a94172259 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kiapi-0.5.2-py3-none-any.whl.
File metadata
- Download URL: kiapi-0.5.2-py3-none-any.whl
- Upload date:
- Size: 470.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6d9273b41710679baa7b20614e77c367fc10dac6a7bb5a57228a7536532cfe2
|
|
| MD5 |
996676df320ff863e71763f065f260c5
|
|
| BLAKE2b-256 |
5074f934fffe3db0594de13b77b45bf60307d9eb53323ac3842a11b9f9e5af2a
|
Provenance
The following attestation bundles were made for kiapi-0.5.2-py3-none-any.whl:
Publisher:
release-pypi.yml on kiarina/kiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiapi-0.5.2-py3-none-any.whl -
Subject digest:
d6d9273b41710679baa7b20614e77c367fc10dac6a7bb5a57228a7536532cfe2 - Sigstore transparency entry: 2280343553
- Sigstore integration time:
-
Permalink:
kiarina/kiapi@53b4abf894caa44be2a1b6256eb4030a94172259 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/kiarina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@53b4abf894caa44be2a1b6256eb4030a94172259 -
Trigger Event:
push
-
Statement type: