LLM Gateway API
One API for the office's local language models. It is compatible with the OpenAI API, so the official openai libraries and most tools work by changing the base URL and the key. Requests are sent to whichever GPU server has the model and is free.
Getting started
| Base URL (OpenAI-compatible) | https://api.loginet.com.au/v1 |
|---|---|
| Base URL (Ollama native) | https://api.loginet.com.au |
| Key | Ask the gateway admin for a key. It looks like sk-lgn-… and is shown only once, so keep it somewhere safe. |
curl https://api.loginet.com.au/v1/chat/completions \
-H "Authorization: Bearer $LLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3:8b","messages":[{"role":"user","content":"Hello!"}]}'
Authentication
Send your key in every request:
Authorization: Bearer sk-lgn-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Each key has a requests-per-minute limit and may be limited to certain models. Keep keys out of browsers and public code; call the API from your server.
Every response has an X-Request-Id header (quote it when reporting a problem) and, when a server answered, X-Gateway-Server with that server's name.
Models
GET /v1/models lists the models your key can use (OpenAI format). GET /api/tags gives the same list in Ollama format. Model names are Ollama names; qwen3 means qwen3:latest.
Available right now:
| Model | State |
|---|---|
bge-m3:latest | loads on first use |
cogito:8b | loads on first use |
gemma3:4b | loads on first use |
gemma3:latest | loads on first use |
granite3.3:8b | loads on first use |
phi4-mini-reasoning:latest | loads on first use |
qwen3-vl:8b | loads on first use |
qwen3-vl:8b-instruct | loaded (fast first answer) |
qwen3:8b | loaded (fast first answer) |
curl https://api.loginet.com.au/v1/models -H "Authorization: Bearer $LLM_API_KEY"
{"object":"list","data":[{"id":"qwen3:8b","object":"model","created":0,"owned_by":"loginet"}]}
Chat completions
POST /v1/chat/completions. Same request and response as OpenAI's Chat Completions API (model, messages, temperature, max_tokens, stream, tools, response_format, …).
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.loginet.com.au/v1", api_key="sk-lgn-...")
reply = client.chat.completions.create(
model="qwen3:8b",
messages=[{"role": "user", "content": "Write a haiku about Sydney rain."}],
)
print(reply.choices[0].message.content)
JavaScript / TypeScript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.loginet.com.au/v1", apiKey: process.env.LLM_API_KEY });
const reply = await client.chat.completions.create({
model: "qwen3:8b",
messages: [{ role: "user", content: "Summarise this in one line: ..." }],
});
console.log(reply.choices[0].message.content);
Response
{
"id": "chatcmpl-123", "object": "chat.completion", "model": "qwen3:8b",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 12, "completion_tokens": 40, "total_tokens": 52 }
}
Streaming
Set "stream": true to receive tokens as they are generated, as Server-Sent Events ending with data: [DONE]. Add "stream_options": {"include_usage": true} to get token counts in a final chunk.
stream = client.chat.completions.create(
model="qwen3:8b",
messages=[{"role": "user", "content": "Tell me a story."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Plain fetch (browser-style or Node)
const res = await fetch("https://api.loginet.com.au/v1/chat/completions", {
method: "POST",
headers: { "Authorization": `Bearer ${key}`, "Content-Type": "application/json" },
body: JSON.stringify({ model: "qwen3:8b", stream: true, messages: [{ role: "user", content: "Hi" }] }),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
for (;;) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop();
for (const line of lines) {
if (!line.startsWith("data: ") || line === "data: [DONE]") continue;
const delta = JSON.parse(line.slice(6)).choices[0]?.delta?.content;
if (delta) process.stdout.write(delta);
}
}
data: {"id":"chatcmpl-1","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Once"}}]}
data: {"id":"chatcmpl-1","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" upon"}}]}
data: [DONE]
Images (vision models)
Vision models such as qwen3-vl:8b-instruct accept images inside a message. Send each image as a base64 data: URL (web links are not fetched). Keep the whole request under 25 MB.
import base64
img = base64.b64encode(open("photo.jpg", "rb").read()).decode()
reply = client.chat.completions.create(
model="qwen3-vl:8b-instruct",
messages=[{"role": "user", "content": [
{"type": "text", "text": "What is in this picture?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{img}"}},
]}],
)
Completions (legacy)
POST /v1/completions with model and prompt, for older clients. Streaming works the same way.
curl https://api.loginet.com.au/v1/completions -H "Authorization: Bearer $LLM_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"qwen3:8b","prompt":"The capital of Australia is","max_tokens":10}'
Embeddings
POST /v1/embeddings with model and input (a string or a list of strings). Use an embedding model such as bge-m3.
vectors = client.embeddings.create(model="bge-m3", input=["first text", "second text"])
print(len(vectors.data[0].embedding)) # 1024 for bge-m3
Speech to text
POST /v1/audio/transcriptions turns an audio file into text, using a Whisper model tuned for Bangla. It works like OpenAI's transcription endpoint: send the file as multipart/form-data with the same API key.
| Field | Required | Meaning |
|---|---|---|
file | yes | The audio (wav, mp3, m4a, ogg, webm …), up to 25 MB. |
language | no | Language code, default bn (Bangla). |
noise_reduction | no | true (default) or false. |
response_format | no | json (default) or text for plain text. |
model | no | Ignored: the server always uses its own speech model, so whisper-1 from OpenAI libraries is fine. |
The JSON answer has text, language, model and duration_seconds. A long recording can take a while; the limit is 10 minutes per request.
curl https://api.loginet.com.au/v1/audio/transcriptions -H "Authorization: Bearer $LLM_API_KEY" \
-F file=@meeting.wav -F language=bn
with open("meeting.wav", "rb") as f:
result = client.audio.transcriptions.create(model="whisper-1", file=f, language="bn")
print(result.text)
Text to speech
POST /v1/audio/speech reads text aloud and returns the audio file. It works like OpenAI's speech endpoint, so OpenAI libraries can use it. Bangla, English and mixed Bangla/English text are supported.
| Field | Required | Meaning |
|---|---|---|
input | yes | The text, up to 4096 characters. Links and code are skipped. |
voice | no | A voice id from GET /v1/audio/voices, default auto-female (reads Bangla and English, female). auto-male is the male one. |
response_format | no | mp3 (default) or wav. |
model | no | Ignored, so tts-1 from OpenAI libraries is fine. |
The answer is the audio itself (audio/mpeg or audio/wav). The limit is 2 minutes per request; for long text, send it a paragraph at a time.
curl https://api.loginet.com.au/v1/audio/speech -H "Authorization: Bearer $LLM_API_KEY" -H "Content-Type: application/json" \
-d '{"input":"আমি ভাত খাই। Hello!","voice":"auto-female"}' -o speech.mp3
audio = client.audio.speech.create(model="tts-1", voice="auto-female", input="আমি ভাত খাই। Hello!")
audio.write_to_file("speech.mp3")
Ollama native API
Apps written for Ollama can point at https://api.loginet.com.au instead of an Ollama server and add the Authorization header. Supported: POST /api/chat, POST /api/generate, POST /api/embed, POST /api/show, GET /api/tags. Model management (/api/pull, /api/delete, /api/create, /api/copy, /api/push, /api/ps) returns 403. Native responses stream as one JSON object per line unless you send "stream": false.
curl https://api.loginet.com.au/api/chat -H "Authorization: Bearer $LLM_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"qwen3:8b","stream":false,"messages":[{"role":"user","content":"Hello"}]}'
import ollama
client = ollama.Client(host="https://api.loginet.com.au", headers={"Authorization": "Bearer sk-lgn-..."})
print(client.chat(model="qwen3:8b", messages=[{"role": "user", "content": "Hello"}])["message"]["content"])
Errors
Errors made by the gateway use the OpenAI shape. Errors returned by a model server itself (for example a bad parameter) are passed through as that server sent them.
{"error": {"message": "The model 'abc' does not exist or you do not have access to it.", "type": "not_found_error", "code": "model_not_found"}}
| HTTP | code | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request | The body is not JSON, or has no "model" string. | Fix the request. |
| 401 | invalid_api_key | The key is missing, wrong, disabled or expired. | Check the Authorization header. Ask the admin for a new key. |
| 400 | voice_not_allowed | Text to speech: that voice runs on a GPU shared with the language models, so it is not offered. | Pick a voice from GET /v1/audio/voices. |
| 403 | forbidden | The endpoint is not offered (for example /api/pull or /api/delete). | Ask the admin; models are managed in the admin panel. |
| 404 | model_not_found | No server offers that model, or your key may not use it. | Call GET /v1/models for what your key can use. |
| 404 | not_found | Unknown /v1 endpoint. | Check the path. |
| 429 | rate_limited | Your key went over its requests-per-minute limit. | Wait for the number of seconds in the Retry-After header. |
| 499 | client_closed | Your app closed the connection before the answer finished (logged only). | — |
| 502 | upstream_error | Every server that could answer failed. | Retry after a short wait. |
| 503 | no_server | The servers with this model are all down right now. | Retry later, or use another model. |
| 504 | upstream_timeout | The model server did not answer in time (stream: no first chunk in 180 s; non-stream: no full answer in 10 minutes). | Use streaming for long answers, or a shorter prompt. |
| 503 | server_busy | Every server with this model stayed busy for 60 seconds. | Retry with backoff. |
Limits and timeouts
- Rate limit: per key, 60 requests per minute unless the admin set another value. Over the limit you get 429 with
Retry-After. - Request size: 25 MB, including images.
- Queueing: when every server with the model is busy your request waits up to 60 seconds, then gets 503
server_busy. - Streaming: the first chunk must arrive within 180 seconds (this covers loading the model). After that there is no overall limit while tokens keep arriving; 120 seconds of silence ends the request.
- Non-streaming: the whole answer must be ready within 10 minutes, or you get 504
upstream_timeout. For long answers use streaming. - Context size:
options.num_ctxis capped at 8192;keep_aliveand GPU memory options are ignored. - Failover: if a server fails before it starts answering, the request is retried on another server (up to 2 times). A stream that breaks midway is not retried; your app sees the connection end without
[DONE]. - Privacy: the gateway records request counts, token counts and timings per key. It does not store prompts or answers.