model-serving

model-serving is a skill for Claude Code, Codex from param087/agent-ml-skills. It costs 42 tokens per session (718 once invoked), scanned A, original, MIT.

A guide to putting a trained machine-learning model behind an API, so other software can send data and receive predictions. It covers the service structure, input checks, model loading, speed, health checks, and monitoring.

In plain words
What is it for?
Use it to build FastAPI prediction services, validate requests, load saved model pipelines, add health endpoints, and improve inference speed.
Why use it?
It addresses the work needed to move a model from a notebook into a service that applications can call reliably. An API is a defined way for programs to exchange requests and responses.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build FastAPI prediction services, validate requests, load saved model pipelines, add health endpoints, and improve inference speed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/param087/agent-ml-skills/model-serving
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add param087/agent-ml-skills --skill model-serving
Clone the repo
git clone --depth 1 https://github.com/param087/agent-ml-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-serving

README.md
[![agentmods](https://agentmods.dev/badge/skills/param087/agent-ml-skills/model-serving/github.svg)](https://agentmods.dev/skills/param087/agent-ml-skills/model-serving)
Your own site
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/model-serving"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/model-serving/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for model-serving

Your own site · 80×15
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/model-serving"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/model-serving.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.00718
Opus 5.5 $0.00017 $0.00287
Sonnet 5.5 $0.00008 $0.00144
Haiku 4.5 $0.00004 $0.00072

Measured 2mo ago against content hash 389cc7559425, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

model-serving scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/model-serving/SKILL.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Serving

Overview

Serving turns a saved model into a reliable, low-latency API. The concerns shift from accuracy to latency, throughput, robustness, and observability. The model artifact and its preprocessing must travel together (use the pipeline from sklearn-pipelines).

When to use

  • A validated model needs to be callable by other systems.
  • Moving from notebook to production.

Minimal FastAPI service

from fastapi import FastAPI
from pydantic import BaseModel
import joblib, numpy as np

app = FastAPI()
model = joblib.load("model.joblib")  # full pipeline: preprocessing + estimator

class Features(BaseModel):
    age: float
    income: float
    country: str
    plan: str

@app.get("/health")
def health():
    return {"status": "ok"}

@app.post("/predict")
def predict(f: Features):
    import pandas as pd
    X = pd.DataFrame([f.model_dump()])
    proba = float(model.predict_proba(X)[0, 1])
    return {"probability": proba, "label": int(proba >= 0.5)}

Run: uvicorn app:app --host 0.0.0.0 --port 8000 --workers 4.

Production checklist

  • Load the model once at startup, not per request.
  • Validate inputs with Pydantic; return 422 on bad payloads.
  • Health/readiness endpoints for orchestrators (k8s).
  • Batch requests where possible to raise throughput.
  • Timeouts + graceful degradation for downstream calls.
  • Version the model in the response (model_version) for traceability.
  • Pin the artifact's training env — preprocessing must match training exactly.

Speed: ONNX + quantization

# Export sklearn/torch model to ONNX, then serve with onnxruntime
import onnxruntime as ort
sess = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
out = sess.run(None, {"input": X.astype(np.float32)})

ONNX runtime + dynamic quantization often gives 2-4x CPU speedups. For LLMs, use vLLM/TGI rather than rolling your own.

Monitoring (don't deploy blind)

  • Operational: latency p50/p95/p99, error rate, throughput.
  • ML-specific: input feature drift, prediction distribution shift, and (when labels arrive) live metric decay.
  • Alert on drift — a silently degrading model is worse than a down one.

Read the full file on GitHub · 85 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 85 lines · 42 tokens per session scan A 389cc7559425

Subscribe to this mod's changes

model-serving is a skill published in the GitHub repository param087/agent-ml-skills (13 stars, last pushed 5mo ago), licensed MIT. It adds 42 tokens to every session and 718 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

model-serving compared with skills from other repositories

model-serving next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
model-servingparam087/agent-ml-skillsSkill135mo agoMITA42Claude Code, Codex
claude-apiPrismer-AI/PrismerCloudSkill1.4k15d agoMITA193Claude Code, Codex
lov-integrate-lovstudio-llm-skilllovstudio/skillsSkill723d agoMITA78Claude Code
Airbyte Connector Config Generatoragentskillexchange/skillsSkill61yesterdayMITA46Claude Code, Codex
kafka-shadowtrafficlensesio/agentic-engineering-for-apache-kafkaSkill672mo agoMITA134Claude Code
powabasepowabase-ai/agent-skillsSkill91mo agoApache-2.0A210Claude Code, Codex
data-pipelinekensaurus/cursor-kenjiSkill91mo agoMITA68Claude Code