Skip to main content

kiapi-proxy

English | 日本語

kiapi-proxy is a proxy server that accepts HTTP requests, forwards them to a kiapi instance over a relay, and returns the result. It relays every kiapi endpoint:

  • JSON responses
  • file / binary responses
  • chat text/event-stream responses (re-emitted as Server-Sent Events)

kiapi only runs on capable Apple Silicon Macs, but kiapi-proxy runs on Linux, Windows, and resource-constrained Macs. It depends only on kiapi-relay (not on kiapi or MLX), so it installs without any heavy inference dependencies.

Installation

pip install kiapi-proxy

# With the GCP relay backend
pip install "kiapi-proxy[relay-gcp]"

Usage

Configure the relay (shared with kiapi via KIAPI_RELAY_* environment variables), then start the proxy:

# Forward through the local filesystem relay
export KIAPI_RELAY_DEFAULT=local
export KIAPI_RELAY_LOCAL_ROOT=/shared/kiapi/relay

kiapi-proxy run --host 0.0.0.0 --port 8080
# or pick the relay explicitly:
kiapi-proxy run --relay local

Then call it as if it were kiapi:

curl http://localhost:8080/health
curl http://localhost:8080/openapi.json
curl -X POST http://localhost:8080/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{"messages":[{"role":"user","content":"hello"}],"stream":true}'

Command line interface

kiapi-proxy mirrors the kiapi command layout, with its own settings file and service registration so the proxy is managed independently from kiapi.

kiapi-proxy run       # start the proxy server
kiapi-proxy check     # check the relay link to kiapi without starting the server
kiapi-proxy config    # manage the user settings file
kiapi-proxy service   # manage the launchd user service (macOS)

Settings file

The proxy keeps its own user settings file, separate from kiapi's:

kiapi-proxy config init      # create it if it does not exist
kiapi-proxy config show      # print the current file
kiapi-proxy config edit      # open it in $EDITOR / $VISUAL
kiapi-proxy config template  # print the full commented template

The file lives in the user config directory (for example ~/.config/kiapi-proxy/settings.yaml) and holds the proxy settings (kiapi_proxy.api) and the relay settings (kiapi_relay). Values set here are loaded on every command; environment variables still take precedence.

Health check

Confirm that requests can travel over the relay to a live kiapi node without starting the proxy server:

kiapi-proxy check --relay local
kiapi-proxy check --relay gcp

check sends a single request (default /health) through the relay and prints the response. Use --path to probe another endpoint and --timeout to bound the wait. Without --relay it falls back to the configured proxy/relay default. It reuses the proxy's persistent relay node ID and holds the single-instance lock, so it fails fast if the proxy server is already running.

Service (macOS)

Register a launchd user agent (io.github.kiarina.kiapi-proxy) that runs kiapi-proxy run, independent from the kiapi service:

kiapi-proxy service install
kiapi-proxy service start
kiapi-proxy service status    # includes an end-to-end /health probe through the relay
kiapi-proxy service stop
kiapi-proxy service uninstall

Configuration

Environment variable Default Description
KIAPI_PROXY_HOST 127.0.0.1 Bind host.
KIAPI_PROXY_PORT 8080 Bind port.
KIAPI_PROXY_RELAY (relay default) Relay specifier to forward through. Falls back to KIAPI_RELAY_DEFAULT.
KIAPI_PROXY_REQUEST_TIMEOUT_S 1800 Maximum time to wait for a relayed response.

Relay backends are configured through kiapi-relay (KIAPI_RELAY_*). See the kiapi-relay documentation.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiapi_proxy-0.5.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiapi_proxy-0.5.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file kiapi_proxy-0.5.0.tar.gz.

File metadata

  • Download URL: kiapi_proxy-0.5.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kiapi_proxy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fa69f13462f9a73cfe1e0b906a7f8c824e5b13d11970f71a24464e92c3115ff2
MD5 173528827920aa6ffcf1062148966eaf
BLAKE2b-256 f18979be865f260ce0d11bb8e7b7d5eb6df967c20f91efef1a04fe471d95f4a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiapi_proxy-0.5.0.tar.gz:

Publisher: release-pypi.yml on kiarina/kiapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kiapi_proxy-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kiapi_proxy-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kiapi_proxy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6914252e7e37e49ed55cc22bee710966390c46309eab04c11d39c8f3a61e4140
MD5 bd8aecbe55c335dee9cb8fa2682243e7
BLAKE2b-256 d74963b5f7d68dff133a385e1400959c66d32792ab5655a63f48e3d7bcfeca10

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiapi_proxy-0.5.0-py3-none-any.whl:

Publisher: release-pypi.yml on kiarina/kiapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.3.0

2 files

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