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
KeyAsk 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:

ModelState
bge-m3:latestloads on first use
cogito:8bloads on first use
gemma3:4bloads on first use
gemma3:latestloads on first use
granite3.3:8bloads on first use
phi4-mini-reasoning:latestloads on first use
qwen3-vl:8bloads on first use
qwen3-vl:8b-instructloaded (fast first answer)
qwen3:8bloaded (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.

FieldRequiredMeaning
fileyesThe audio (wav, mp3, m4a, ogg, webm …), up to 25 MB.
languagenoLanguage code, default bn (Bangla).
noise_reductionnotrue (default) or false.
response_formatnojson (default) or text for plain text.
modelnoIgnored: 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.

FieldRequiredMeaning
inputyesThe text, up to 4096 characters. Links and code are skipped.
voicenoA voice id from GET /v1/audio/voices, default auto-female (reads Bangla and English, female). auto-male is the male one.
response_formatnomp3 (default) or wav.
modelnoIgnored, 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"}}
HTTPcodeMeaningWhat to do
400invalid_requestThe body is not JSON, or has no "model" string.Fix the request.
401invalid_api_keyThe key is missing, wrong, disabled or expired.Check the Authorization header. Ask the admin for a new key.
400voice_not_allowedText 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.
403forbiddenThe endpoint is not offered (for example /api/pull or /api/delete).Ask the admin; models are managed in the admin panel.
404model_not_foundNo server offers that model, or your key may not use it.Call GET /v1/models for what your key can use.
404not_foundUnknown /v1 endpoint.Check the path.
429rate_limitedYour key went over its requests-per-minute limit.Wait for the number of seconds in the Retry-After header.
499client_closedYour app closed the connection before the answer finished (logged only).—
502upstream_errorEvery server that could answer failed.Retry after a short wait.
503no_serverThe servers with this model are all down right now.Retry later, or use another model.
504upstream_timeoutThe 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.
503server_busyEvery server with this model stayed busy for 60 seconds.Retry with backoff.

Limits and timeouts