ollama-queue-proxy AGENTS.md

Project instructions for ollama-queue-proxy, a FastAPI service that sits between clients and Ollama AI model servers. It describes the service's features, files, and configuration.

In plain words
What is it for?
Use it when working on the proxy's request routing, priority queues, client limits, API-key checks, embedding cache, health checks, or OpenAI-compatible API.
Why use it?
It gives coding agents the project context needed to change the proxy without misunderstanding how requests, hosts, queues, authentication, and caching fit together.

Instructions file for CodexOpenCode

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.

agentmods
npx agentmods add instructions/tadmstr/ollama-queue-proxy/agents-md
Clone the repo
git clone --depth 1 https://github.com/TadMSTR/ollama-queue-proxy

Made for: Codex, OpenCode.

Per session 792 This file is loaded in full into every session.
When invoked 792 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00792 $0.00792
Opus 5 $0.00396 $0.00396
Sonnet 5 $0.00158 $0.00158
Haiku 4.5 $0.00079 $0.00079

Measured yesterday against content hash ce2d153fd75c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ollama-queue-proxy AGENTS.md 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 yesterday.

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.

AGENTS.md · 73 lines

How it starts

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

ollama-queue-proxy

FastAPI reverse proxy for Ollama with priority queuing, per-client API key auth, embedding response caching, OpenAI-compatible API translation, and multi-host routing.

What it does

Sits in front of one or more Ollama instances and provides: authenticated access, request prioritization, per-client concurrency limits, embedding caching, and an OpenAI-compatible API surface.

Structure

src/ollama_queue_proxy/
  main.py             FastAPI app + lifespan — wires together all managers
  config.py           Config dataclass, load_config() from YAML
  auth.py             AuthManager — per-client API key validation
  queue.py            PriorityQueueManager — priority queue, TTL, pause/resume
  proxy.py            dispatch_request() — forwards requests to selected Ollama host
  routing.py          RoutingTable — model-to-host assignment
  hosts.py            HostManager — Ollama host pool, health checks
  concurrency.py      ClientConcurrencyManager — per-client request limits
  cache.py            EmbeddingCache — response cache for /api/embeddings
  openai_compat.py    OpenAI → Ollama path rewriting and response wrapping
  middleware.py       RequestContextMiddleware — injects client_id, priority
  injection.py        AppState singleton for dependency injection
  webhooks.py         WebhookManager — posts queue events to a webhook URL
  routes/
    queue.py          Queue management endpoints (/queue/status, /queue/pause, etc.)
    status.py         Health and metrics endpoints
tests/                pytest tests
config.example.yml    Reference configuration
Dockerfile            Docker image

Source files

File Role
main.py App entrypoint, lifespan startup/shutdown, manager wiring
config.py YAML config loading; all tunables defined here
auth.py Per-client key lookup and validation
queue.py Async priority queue, TTL expiry, pause/resume per client
proxy.py Upstream dispatch, timeout, error handling
routing.py Maps model names to target host(s)
hosts.py Host pool management and health polling
openai_compat.py Path rewriting and response schema wrapping for OpenAI clients
webhooks.py SSRF-validated webhook delivery for queue events

Read the full file on GitHub · 73 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. yesterday First seen · 73 lines · 792 tokens per session scan A ce2d153fd75c

Subscribe to this mod's changes

ollama-queue-proxy AGENTS.md is an instructions file published in the GitHub repository TadMSTR/ollama-queue-proxy (2 stars, last pushed 2mo ago), licensed MIT. It adds 792 tokens to every session, about $0.0040 per session on Opus 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.