Metadata-Version: 2.4
Name: hugpy-core
Version: 0.5.0
Summary: Hugpy Core: the coordinator of the wrappers of many hosts
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: abstract-flask>=0.0.0.1079
Requires-Dist: flask<4,>=3
Requires-Dist: hugpy-resources<0.2,>=0.1.18.2

# hugpy-core

Hugpy Core connects workers into a fleet. Clients send an inference request to one address. Core finds a Wrapper offering the requested model, relays the request and streams its answer. Operators use the web console to inspect workers, models, calls and grading results.

## Installation

Use a Python 3.11 or later environment on the coordinating host. A local GPU is optional. Core stores fleet state in SQLite.

```sh
python -m pip install 'hugpy-core>=0.5,<0.6'
```

## Quick start

Start Core in one terminal.

```sh
hugpy-core serve
```

Open `http://127.0.0.1:7002/console`. If this host also has a system-installed Wrapper, run the following in another terminal.

```sh
hugpy-core connect local
hugpy-core wrappers
hugpy-core models
```

For a remote worker, use `hugpy-core connect URL --key KEY` with the Wrapper address and its key. A worker behind a router can initiate the connection with `hugpy-wrapper system register --core URL --core-key KEY --link`.

## Compute

`hugpy-core compute` shows connected workers, their memory and their serving model variations. Select a worker by name to inspect its routing, residency and hardware. Add `--json` to include the complete worker report and per-model measurements. The same controls are available in the [web Compute panel](https://dev.hugpy.ai/console#compute).

```sh
hugpy-core compute
hugpy-core compute --worker NAME --query gguf --json
hugpy-core compute options --worker NAME --model 'org/model::variation'
hugpy-core compute test-history --worker NAME
```

Use a full `model_key` from the worker report for model operations. `compute assign` adds a routing allocation, `compute pin` protects it, and `compute load` asks the worker to load the variation. `hugpy-core compute --help` lists the available controls and options.

## Inference and discovery

`GET /v1/models` lists models across connected workers. Model entries describe supported endpoints. Send the request to the advertised path, such as `POST /v1/chat/completions`. The responding worker owns queueing, memory placement and execution. `GET /v1/requests/{request_id}` reports progress, and `GET /v1/artifacts/{id}` retrieves files produced by a call.

`GET /api/schema` describes Core routes and inspects standalone services registered under `/usr/share/hugpy/arms.d`. Use it to discover the routes available on a particular installation.

## Model downloads

With the Downloader daemon running on the same host, Core exposes the Hugging Face and Civitai catalogs and the download queue under `/api/downloads/`. The console can inspect a job, enqueue a download, cancel or retry it. Core forwards these operations to Downloader on loopback. `HUGPY_DOWNLOADER_HTTP_PORT` sets the upstream port (default `8767`).

## Grading and operations

Use `hugpy-core schedule MODEL` to inspect the grading queries for a model. `hugpy-core test-fire WRAPPER` submits the next outstanding queries as inference calls on that worker. `hugpy-core rounds` lists runs, and `hugpy-core grading` reports results derived from the recorded answers.

![Inference activity by worker in the Hugpy metrics console](https://hugpy.ai/downloads/gallery/hugpy/hugpy-metrics.png)

Core binds to loopback by default. Console reads and some console actions are available to callers who can reach it. Worker enrollment and key management require credentials. The API-key setting controls whether model calls need a key. Configure access at the proxy when making the console reachable outside the host.

For a host service, run `hugpy-core system install` with administrative privileges from an installation readable by the service account. The service keeps its database and keys under `/var/lib/hugpy/core`. Per-user runs use `~/.local/share/hugpy/core` by default.
