Files
llmgw/internal/web/templates/apidocs.html
T
Ilker ManapandClaude Opus 5.5 fd3c7bda32
CI / test (push) Failing after 6m12s
The client API described in OpenAPI, and both APIs in Swagger UI
/v1/openapi.json is the API clients use — OpenAI's endpoints, Anthropic's,
and what llmgw adds — in OpenAPI 3.1, generated from internal/clientapi's
route table by the generator the admin API's document comes from, now
told each document's title, server, token and error. A test reads the
router's mux.HandleFunc calls and refuses a route described and not
mounted, or mounted and not described. Asked for before there is a key,
so it needs none.

/docs/api shows it in Swagger UI 5.33.1 (Apache 2.0, served from the
gateway as the page's policy requires): Authorize takes a key, Try it out
sends to this gateway. Staff are offered the admin API's document too,
from /docs/api/admin.json, which nobody else is given.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 20:22:48 +02:00

42 lines
1.7 KiB
HTML

{{define "apidocs"}}<!doctype html>
<html lang="{{lang}}"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{t "docs.api_title"}} · {{t "docs.title"}}</title>
<link rel="stylesheet" href="{{stylesheet}}">
<link rel="stylesheet" href="{{asset "docs.css"}}">
<link rel="stylesheet" href="{{asset "swagger/swagger-ui.css"}}">
</head><body><div class="wrap">
<header class="docs-head">
<p class="docs-brand"><a href="/docs">{{t "docs.title"}}</a></p>
{{if .SignedIn}}{{template "nav" .Nav}}{{else}}
<nav class="menu" aria-label="{{t "nav.aria"}}">
<a href="/">{{t "docs.this_gateway"}}</a>
<a href="/docs">{{t "nav.docs"}}</a>
<a href="/about">{{t "docs.about"}}</a>
{{if .SignIn}}<a href="/login">{{t "landing.sign_in"}}</a>{{end}}
</nav>{{end}}
</header>
<h1>{{t "docs.api_title"}}</h1>
<p class="sub">{{th "docs.api_sub"}}</p>
<div id="swagger" class="api-docs"></div>
<footer><span><a href="/about">llmgw {{.Version}}</a></span><span><a href="/docs">{{t "docs.footer"}}</a></span>{{template "langs"}}</footer>
</div>
<script src="{{asset "swagger/swagger-ui-bundle.js"}}"></script>
<script src="{{asset "swagger/swagger-ui-standalone-preset.js"}}"></script>
<script>
const specs = {{.Specs}};
window.addEventListener("load", function () {
SwaggerUIBundle({
urls: specs,
"urls.primaryName": specs[0].name,
dom_id: "#swagger",
deepLinking: true,
// The key is typed into Authorize and kept for this page only.
persistAuthorization: false,
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
layout: "StandaloneLayout",
});
});
</script>
</body></html>{{end}}