The portal in English and Turkish: a catalogue per language, a switcher at the foot of every page, landing.language, Turkish numbers and dates
Every template and handler message in internal/web goes through a JSON
catalogue under internal/web/locales/<code>/, with English as the fallback.
The language is the person's choice (a cookie set by /_lang/{code}), else
Accept-Language, else landing.language. Tests refuse a key some language
lacks, a translation with other arguments than English, and template text
left in English.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
30f7f3474a
commit
11231d8c2b
113 files changed
+8091
-1981
No files matched your search
@@ -1,20 +1,20 @@
|
||||
{{define "claim"}}<!doctype html>
|
||||
<html lang="en"><head>
|
||||
<html lang="{{lang}}"><head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Your llmgw key</title><link rel="stylesheet" href="{{stylesheet}}">
|
||||
<title>{{t "claim.title"}}</title><link rel="stylesheet" href="{{stylesheet}}">
|
||||
</head><body><div class="wrap">
|
||||
<header>
|
||||
<h1>Your API key</h1>
|
||||
<p class="sub">llmgw · {{.BaseURL}}</p>
|
||||
<h1>{{t "claim.heading"}}</h1>
|
||||
<p class="sub" translate="no">llmgw · {{.BaseURL}}</p>
|
||||
</header>
|
||||
|
||||
{{if .Secret}}
|
||||
<p>This is shown once. Nothing can produce it again — only its hash was kept.</p>
|
||||
<p>{{t "claim.shown_once"}}</p>
|
||||
<pre>{{.Secret}}</pre>
|
||||
<p>Store it in a password manager now, then close this page.</p>
|
||||
<p>{{t "claim.store_it"}}</p>
|
||||
|
||||
<h2>Using it</h2>
|
||||
<h2>{{t "claim.using_it"}}</h2>
|
||||
<pre>export LLMGW_API_KEY={{.Secret}}
|
||||
|
||||
curl {{.BaseURL}}/v1/chat/completions \
|
||||
@@ -22,27 +22,23 @@ curl {{.BaseURL}}/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model": "<model-name>", "messages": [{"role":"user","content":"hello"}]}'</pre>
|
||||
<p class="note">
|
||||
Replace <model-name> with a name from
|
||||
<code>GET {{.BaseURL}}/v1/models</code>, which needs your key. Sending the
|
||||
placeholder unchanged is answered with the list of models that are available.
|
||||
{{th "claim.replace_placeholder" .BaseURL}}
|
||||
</p>
|
||||
<pre>from openai import OpenAI
|
||||
client = OpenAI(base_url="{{.BaseURL}}/v1", api_key=os.environ["LLMGW_API_KEY"])</pre>
|
||||
<p class="note"><code>GET {{.BaseURL}}/v1/models</code> lists what this key may use.
|
||||
<code>GET {{.BaseURL}}/me</code> shows its limits and what it has spent.</p>
|
||||
<p class="note">{{th "claim.endpoints" .BaseURL}}</p>
|
||||
|
||||
{{else if .Gone}}
|
||||
<p>{{.Message}}</p>
|
||||
<p class="note">A link works once and then expires. Ask whoever sent it for a new one.</p>
|
||||
<p class="note">{{t "claim.ask_again"}}</p>
|
||||
|
||||
{{else}}
|
||||
<p>A key was issued for you. Revealing it uses up this link, and the key is
|
||||
shown only this once.</p>
|
||||
<p>{{t "claim.issued"}}</p>
|
||||
<form method="post">
|
||||
<button type="submit">Reveal my key</button>
|
||||
<button type="submit">{{t "claim.reveal"}}</button>
|
||||
</form>
|
||||
<p class="note">Expires {{.ExpiresAt}}.</p>
|
||||
<p class="note">{{t "claim.expires" .ExpiresAt}}</p>
|
||||
{{end}}
|
||||
|
||||
<footer><span>llmgw {{.Version}}</span><span>{{.Now}}</span></footer>
|
||||
<footer><span>llmgw {{.Version}}</span><span>{{.Now}}</span>{{template "langs"}}</footer>
|
||||
</div></body></html>{{end}}
|
||||
Reference in new issue
Block a user