{{define "landing"}}
{{t "landing.sub"}}
{{t "landing.lede"}}
{{if .SignupOpen}}{{t "landing.create_account"}} {{t "landing.sign_in"}} {{else if .AuthEnabled}}{{t "landing.sign_in"}}{{end}}
{{.BaseURL}}/v1
{{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"}}
{{t "landing.step2_text"}}
export OPENAI_BASE_URL={{.BaseURL}}/v1
export OPENAI_API_KEY=$LLMGW_API_KEY
{{th "landing.step3_keyed"}}
{{else}}{{th "landing.step3_open"}}
{{end}}{{th "landing.step3_placeholder"}}
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"}}
GET {{.BaseURL}}/v1/models{{t "landing.models_endpoint"}}GET {{.BaseURL}}/me{{t "landing.me_endpoint"}}