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.
npx skills add jkaninda/okapi-skills --skill middlewaregit clone --depth 1 https://github.com/jkaninda/okapi-skillsWrote 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.
[](https://agentmods.dev/skills/jkaninda/okapi-skills/middleware)<a href="https://agentmods.dev/skills/jkaninda/okapi-skills/middleware"><img src="https://agentmods.dev/badge/skills/jkaninda/okapi-skills/middleware/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.
<a href="https://agentmods.dev/skills/jkaninda/okapi-skills/middleware"><img src="https://agentmods.dev/badge/skills/jkaninda/okapi-skills/middleware.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01340 |
| Opus 5.5 | $0.00000 | $0.00536 |
| Sonnet 5.5 | $0.00000 | $0.00268 |
| Haiku 4.5 | $0.00000 | $0.00134 |
Grade A, and why
middleware 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 148 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Okapi Middleware
Middleware and MiddlewareFunc are type aliases of HandlerFunc — func(*Context) error. Inside a middleware, call c.Next() to pass control down the chain. Anything before c.Next() runs on the way in, anything after runs on the way out.
func custom(c *okapi.Context) error {
start := time.Now()
err := c.Next()
log.Printf("Request took %v", time.Since(start))
return err
}
o.Use(custom)
Signature change (v0.5.0). Middleware is no longer
func(next HandlerFunc) HandlerFunc. Drop the outer wrapper and replacenext(c)withc.Next():// Before (v0.4.x) // After (v0.5.0+) func mw(next okapi.HandlerFunc) okapi.HandlerFunc { func mw(c *okapi.Context) error { return func(c *okapi.Context) error { err := c.Next() err := next(c) return err return err } } }A middleware that needs configuration returns a closure with the new signature:
func RateLimit(rps int) okapi.Middleware { return func(c *okapi.Context) error { ... } }.
Built-in Middleware
| Middleware | Purpose |
|---|---|
okapi.LoggerMiddleware |
Structured access logging (method, URL, IP, status, duration, referer, UA). Skips WebSocket upgrades and SSE streams. Enabled in okapi.Default(). |
okapi.RequestID() |
Reads X-Request-ID or generates a UUID; stores in context ("request_id") and echoes the header. |
okapi.BasicAuth{...}.Middleware |
Basic auth — constant-time compare; sends WWW-Authenticate on failure. |
okapi.JWTAuth{...}.Middleware |
JWT validation (HS256 / RS256 / JWKS), claims expression DSL, claim forwarding. |
okapi.BodyLimit{MaxBytes: 1<<20}.Middleware |
Rejects requests larger than MaxBytes with 413. |
okapi.Cors{...}.CORSHandler |
CORS preflight + headers (wildcards, credentials, expose headers, max-age). Usually attached via WithCors(). |
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.
- 1mo ago First seen · 148 lines · 0 tokens per session scan A 85f974475040
middleware is a skill published in the GitHub repository jkaninda/okapi-skills (4 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,340 tokens. 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.
Other skills, from other repositories
telnyx-numbers-go
Search, order, and manage phone numbers by location, features, and coverage.
af-xdp
AFXDP skill for high-performance XDP sockets. Use when creating AFXDP sockets, configuring UMEM and XSK rings, XDPREDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AFXDP, xskumem, XDPREDIRECT, libbpf xsk, or zero-copy XDP.
go-services
Build production Go HTTP services with Go 1.22+ ServeMux patterns, context cancellation, graceful Shutdown deadlines, middleware, race-safe tests, and multi-stage Docker binaries.
telnyx-messaging-go
Send and receive SMS/MMS, handle opt-outs and delivery webhooks. Use for notifications, 2FA, or messaging apps.
telnyx-porting-out-go
Manage port-out requests when numbers are being ported away from Telnyx. List, view, and update port-out status. This skill provides Go SDK examples.
telnyx-account-go
Manage account balance, payments, invoices, webhooks, and view audit logs and detail records. This skill provides Go SDK examples.