Files
homelab-frontend/tasks/2.5-models-endpoint.md
T
Story Crater BotandClaude Opus 5 058f11cf2b
CI / Test (push) Canceled after 0s
CI / Vet (push) Canceled after 0s
CI / Build (push) Canceled after 0s
CI / Security (govulncheck) (push) Canceled after 0s
chore: initial commit of Go API gateway
Baseline for the Kong replacement on api.riotpiao.com. Brings the working
tree under version control for the first time: gateway source, the task
board that drives the agent runs, test fixtures, and K8s manifests.

Anchor the gateway ignore rule to the repo root. Unanchored, "gateway"
also matched the cmd/gateway/ source directory, so the program entrypoint
was excluded from every commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-08-19 20:54:34 -07:00

1.6 KiB

2.5 — GET /v1/models (GREEN)

Phase: 2 — LLM surface Stage: GREEN Depends on: 2.1

  • GET /v1/models returns 200 with Content-Type: application/json
  • The response shape is {"object":"list","data":[{"id","object":"model","owned_by","created"}]}
  • Every entry's object is the literal string model
  • The id values are exactly the model names the configured registry will accept for dispatch — no more, no fewer
  • Adding or removing a model in configuration changes this response with no code change
  • No model list is hardcoded anywhere; the list cannot disagree with what routing accepts
  • The endpoint contacts no upstream and stays cheap

Kong served a static list via request-termination, and its own manifest flags that the list can drift from what the engines actually serve. Deriving from the registry makes that drift structurally impossible: the same source answers this endpoint and decides which model values dispatch.

Verify

curl -s localhost:8080/v1/models
# expected: 200, {"object":"list","data":[...]} with ids reasoning, ornith:35b, qwen2.5:3b-instruct,
#           nomic-ai/nomic-embed-text-v2-moe, BAAI/bge-reranker-base

# every advertised id must dispatch; nothing advertised may 404
for m in $(curl -s localhost:8080/v1/models | grep -o '"id":"[^"]*"' | cut -d'"' -f4); do
  curl -s -o /dev/null -w "$m %{http_code}\n" localhost:8080/v1/chat/completions \
    -H 'content-type: application/json' -d "{\"model\":\"$m\",\"messages\":[]}"
done
# expected: no unknown-model rejection for any advertised id