AGENT SKILL

kev-deploy

Deploy a Kev decision model (the open Jev-style System One model) as the user's own TypeSafe-compatible HTTPS endpoint on Modal with one command, wire it into their code, and take it down. Use when someone wants to host Kev, get a Kev API URL, replace Jev / TypeSafe calls with a self-hosted model, pick a Kev size or GPU, add an API key, keep an endpoint warm, or stop and remove a Kev deployment.

License 许可
Apache-2.0
最近更新
2026-10-05
Stars
★ 0
Forks
0

01 前言 Front Matter

name
kev-deploy
license
Apache-2.0
metadata
{ "author": "jaredpalmer", "version": "1.0", "repository": "https://github.com/jaredpalmer/kev" }
description
Deploy a Kev decision model (the open Jev-style System One model) as the user's own TypeSafe-compatible HTTPS endpoint on Modal with one command, wire it into their code, and take it down. Use when someone wants to host Kev, get a Kev API URL, replace Jev / TypeSafe calls with a self-hosted model, pick a Kev size or GPU, add an API key, keep an endpoint warm, or stop and remove a Kev deployment.
compatibility
Requires Python 3.10+ and a Modal account (`pip install modal && modal setup`, free tier works for the small models). No GPU, no clone of the Kev repo, no Hugging Face account for the public checkpoints.

02 资源文件 2

03 SKILL.md 正文

Deploy Kev on Modal

scripts/kev_serve.py is a single self-contained Modal app. modal deploy on it builds an image with the kev package at a pinned commit, loads a Kev checkpoint from the Hugging Face Hub on a GPU sized for it, and serves TypeSafe's System One protocol (POST /v1/systemone, GET /v1/models) at https://<workspace>--kev-api.modal.run. It scales to zero when idle. The file is short on purpose: if the user's case does not fit, read it and edit it.

1. Check the prerequisites

python3 -c "import modal" 2>/dev/null || pip install modal
modal profile current 2>/dev/null || modal setup      # opens a browser to sign in; the user must do this step
modal skills install -y                               # optional: Modal's own agent skill + docs (into .agents/, or -g for home)

If modal setup is needed, tell the user and wait; do not try to authenticate for them. modal skills install gives you Modal's official skill and documentation, which helps with anything beyond this file: GPUs, secrets, volumes, logs, billing.

2. Pick the model

KEV_MODEL GPU (automatic; fallbacks in parentheses) Cold start, measured 2026-09-23 (first ever / weights cached) Idle cost When
jaredpalmer/kev-0.8b L4 (A10G, L40S) 77 s / 33 s $0 (scales to zero) cheapest, prototyping
jaredpalmer/kev-4b (default) L4 (A10G, L40S) ~2 min / 52 s $0 the default: best quality per dollar
jaredpalmer/kev-9b A100-80GB (H100) 128 s / 42 s $0 best released accuracy

A warm container costs the GPU's hourly rate only while it is up (L4 about $0.80/h, A100-80GB about $2.50/h); after five idle minutes it scales to zero. KEV_MIN_CONTAINERS=1 keeps one warm (no cold starts, pays the hourly rate all the time). Any Kev checkpoint on the Hub works (you/kev-4b-support, repo@revision); the GPU is picked by the name's size prefix (kev-4b... -> L4), anything else gets an H100 unless KEV_GPU says otherwise. A private checkpoint needs HF_TOKEN at deploy time; the file uploads HF_TOKEN as a Modal secret whenever it is set in the shell, so unset it for public ones. Checkpoints fine-tuned with the kev-finetune skill deploy the same way once published.

3. Deploy

Always set an API key unless the user explicitly wants a public URL; without one, anyone with the URL can spend their GPU time.

curl -LO https://raw.githubusercontent.com/jaredpalmer/kev/main/skills/kev-deploy/scripts/kev_serve.py   # or use the skill's copy
export KEV_API_KEY=$(openssl rand -hex 24)                # save it: it is the endpoint's bearer token
KEV_MODEL=jaredpalmer/kev-4b modal deploy kev_serve.py    # prints the URL

Settings are read at deploy time; redeploying with other values replaces the model behind the same URL. KEV_APP_NAME=kev-support gives a second, independent endpoint (https://<workspace>--kev-support-api.modal.run). KEV_GPU=H100 overrides the GPU.

4. Verify

The first request after a deploy or an idle period waits for the cold start. Modal answers a request that waits longer than 150 s with an HTTP 303 to a result URL, so warm the endpoint with a redirect-following call first:

curl -sL --max-time 900 $KEV_URL/v1/models -H "authorization: Bearer $KEV_API_KEY"   # returns once the model is loaded
curl -s $KEV_URL/v1/systemone -H "authorization: Bearer $KEV_API_KEY" -H 'content-type: application/json' -d '{
  "state": "Order 4411 arrived late and the box was crushed. Two charges appear on my card.", "model": "kev-latest",
  "questions": {"team": {"type": "choice", "instructions": "Which team should handle this?",
                         "criteria": {"returns": "Exchanges, refunds", "shipping": "Delivery, delays", "billing": "Charges, payments"}},
                "urgent": {"type": "noul", "instructions": "Does this need urgent human attention?"}}}'
curl -s $KEV_URL/v1/models -H "authorization: Bearer $KEV_API_KEY"       # served checkpoint, base, temperature

Expect per-question probabilities (calibrated by the checkpoint's own temperature), choice / noul / score, latency_ms (about 80-150 ms warm on an L4 for a short state). A request without the key must return 401.

5. Wire it in

The protocol is TypeSafe's, so only the base URL and key change:

client = TypeSafeClient(api_key=KEV_API_KEY, base_url=KEV_URL, model="kev-latest")   # was: TypeSafeClient(api_key=TYPESAFE_KEY)
const r = await fetch(`${KEV_URL}/v1/systemone`, { method: "POST",
  headers: { "content-type": "application/json", authorization: `Bearer ${KEV_API_KEY}` },
  body: JSON.stringify({ state, model: "kev-latest", questions }) });   // question type "noul", not "boolean"

Kev answers typed questions about a state (Choice over named options, Noul yes/no, Score over ordered levels) without generating text. It was trained on public classification, policy and rule data; on the user's own domain, measure it on a few hundred labelled examples before relying on it, and if it falls short, fine-tune it with the kev-finetune skill.

6. Take it down

modal app stop kev            # or the KEV_APP_NAME used; the URL stops working immediately
modal volume delete kev-hf-cache   # optional: the cached weights (shared with kev-finetune; next deploy re-downloads)

Troubleshooting

  • First request returns nothing or a 303: the cold start is still running (weights download on the very first start, or Modal is still finding a GPU; modal app logs kev says "waiting to be scheduled"). Follow redirects (curl -L), use a longer client timeout, or deploy with KEV_MIN_CONTAINERS=1.
  • CUDA out of memory on start: the GPU is too small for that checkpoint; use the table above or KEV_GPU=H100.
  • 401 with the right key: the key is fixed at deploy time; redeploy with the same KEV_API_KEY exported.
  • Logs: modal app logs kev shows the load line (serving <model> on <GPU> ... ready in Ns) and every request.

04 同仓库更多 Skills