{{define "landing"}} llmgw
{{if .Notice}}{{end}} {{if not .AuthEnabled}} {{end}}

llmgw

{{t "landing.sub"}}

{{t "landing.lede"}}

{{if .SignupOpen}}{{t "landing.create_account"}} {{t "landing.sign_in"}} {{else if .AuthEnabled}}{{t "landing.sign_in"}}{{end}}

{{/* A schematic of what this is, not of what is installed here. It names no model, no node and no count: this page is served to anyone who can reach the address. */}}
{{t "landing.schematic.client"}} {{t "landing.schematic.editor"}} {{t "landing.schematic.script"}} llmgw {{t "landing.schematic.address"}} {{t "landing.schematic.fabric"}} {{t "landing.schematic.fabric"}}
{{t "landing.schematic_caption"}}
{{t "landing.base_url"}} {{.BaseURL}}/v1

{{t "landing.three_steps"}}

  1. 1

    {{t "landing.step1"}}

    {{if .SignupOpen}}

    {{th "landing.step1_signup"}}

    {{else if .Contact}}

    {{th "landing.step1_contact" .ContactHTML}}{{if .AuthEnabled}}{{th "landing.step1_contact_signin"}}{{end}}

    {{else}}

    {{t "landing.step1_nobody"}}

    {{end}}

    {{t "landing.step1_shown_once"}}

  2. 2

    {{t "landing.step2"}}

    {{t "landing.step2_text"}}

    export OPENAI_BASE_URL={{.BaseURL}}/v1
    export OPENAI_API_KEY=$LLMGW_API_KEY
  3. 3

    {{t "landing.step3"}}

    {{if .AuthEnabled}}

    {{th "landing.step3_keyed"}}

    {{else}}

    {{th "landing.step3_open"}}

    {{end}}

    {{th "landing.step3_placeholder"}}

{{t "landing.connect"}}

curl {{.BaseURL}}/v1/chat/completions \
  -H "Authorization: Bearer $LLMGW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-name>",
       "messages": [{"role": "user", "content": "hello"}]}'
import os
from openai import OpenAI

client = OpenAI(base_url="{{.BaseURL}}/v1",
                api_key=os.environ["LLMGW_API_KEY"])

reply = client.chat.completions.create(
    model="<model-name>",
    messages=[{"role": "user", "content": "hello"}],
)
print(reply.choices[0].message.content)
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "llmgw": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "llmgw",
      "options": {
        "baseURL": "{{.BaseURL}}/v1",
        "apiKey": "{env:LLMGW_API_KEY}"
      },
      "models": { "<model-name>": { "name": "<model-name>" } }
    }
  }
}

{{t "landing.anything_works"}} {{th "landing.client_guide"}}

{{t "landing.once_you_have_key"}}

{{end}}