API documentation.
A straightforward HTTP API for interacting with a range of language models. List available models, request a full completion, or stream a response token-by-token — all through a single base URL.
Overview
A straightforward HTTP API for interacting with a range of language models. List available models, request a full completion, or stream a response token-by-token — all through a single base URL.
Base URL
All API requests are made to https://nukerhugo.nl/ai/api/index.php. The desired action is selected using the endpoint query parameter.
Endpoints
The API exposes three actions from a single base URL, selected via the endpoint query parameter.
| What you want | Request |
|---|---|
| List models | GET?endpoint=models |
| Full chat reply | POST?endpoint=chat |
| Streaming reply | POST?endpoint=chat/stream |
Authentication
This API does not require authentication for the open-access model set. No API keys, tokens, or headers beyond Content-Type: application/json are needed to make requests. Larger, key-gated models (such as deepseek-v4-flash) are available through the Enterprise API. Free keys for testing are available on the Enterprise page; see Key-gated models below for how to use one.
Because the endpoint is open, please use it responsibly. Abusive request patterns may result in rate limiting or access restrictions. No fixed rate limit is published for the open-access models; see the Terms.
Prompts and model outputs are not stored or logged. Only minimal request metadata (timestamps and request counts) is kept. See the Data Retention Policy.
GETList models
Returns the list of open-access models currently available for use in chat requests.
| Request | Content-Type | Auth required |
|---|---|---|
?endpoint=models | application/json | No |
curl "https://nukerhugo.nl/ai/api/index.php?endpoint=models"Response:
{
"default": "gemma-1b",
"available": {
"gemma-1b": { "context_window": 2048 },
"qwen-1.5b": { "context_window": 4096 },
"qwen-3b": { "context_window": 4096 },
"nukegpt-3b": { "context_window": 4096 },
"nukegpt-360m": { "context_window": 2048 },
"smollm2-360m": { "context_window": 2048 },
"bonsai-27b": { "context_window": 8192 },
"bonsai-27b-slow": { "context_window": 8192 }
}
}default is the model used if a request omits model. available is an object keyed by model ID, not an array — look up a model's context_window via its key.
Available models are added and removed periodically. Call this endpoint at runtime rather than hardcoding model IDs, and treat the list above as a snapshot rather than a guarantee. You can also check live status for a real-time read. Key-gated models are not included in this list; see Key-gated models.
POSTChat
For a full, non-streamed reply, use the chat endpoint with a model and a messages array.
| Field | Type | Description |
|---|---|---|
model | string | Identifier of the model to use. See List Models for valid values. Optional — omitting it uses the default model returned by List Models. |
messages required | array | Array of {role, content} objects. role is system, user, or assistant. An optional system message may lead the array to set behavior/persona; user/assistant turns after it should alternate, ending on user. |
{
"model": "qwen-1.5b",
"messages": [
{ "role": "user", "content": "Hello!" }
]
}Response:
{
"model": "qwen-1.5b",
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"usage": {
"prompt_tokens": 67,
"completion_tokens": 12,
"total_tokens": 79
}
}curl -X POST "https://nukerhugo.nl/ai/api/index.php?endpoint=chat" \
-H "Content-Type: application/json" \
-d '{"model":"qwen-1.5b","messages":[{"role":"user","content":"Hello!"}]}'System prompts
Prepend a system message to the messages array to set behavior, tone, or persona for the conversation. Supported on all available models, including gemma-1b.
{
"model": "gemma-1b",
"messages": [
{ "role": "system", "content": "You are a pirate. Speak only in pirate." },
{ "role": "user", "content": "Hello!" }
]
}POSTChat (streaming)
Same request shape as chat, but the response streams as newline-delimited data: lines, each holding a small JSON chunk. Use this to render tokens as they arrive.
const response = await fetch('https://nukerhugo.nl/ai/api/index.php?endpoint=chat/stream', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'qwen-1.5b',
messages: [{ role: 'user', content: 'Tell me a short story.' }]
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
for (const line of chunk.split('\n')) {
if (!line.startsWith('data:')) continue;
const data = JSON.parse(line.slice(5));
if (data.token) document.body.append(data.token);
if (data.done) console.log('stream finished');
}
}Each line decodes to {"token": "..."} for generated text, and a final {"done": true} once the stream ends.
Multi-turn conversations
Each request is independent. To continue a conversation, include the full prior history in the messages array, alternating user / assistant turns, and ending on a user message.
{
"model": "qwen-1.5b",
"messages": [
{ "role": "user", "content": "What is 2+2?" },
{ "role": "assistant", "content": "4" },
{ "role": "user", "content": "Multiply that by 3." }
]
}The combined token count of all messages in the array, plus the reply, must stay within the chosen model's context window (see List Models — this varies by model: 2048, 4096 or 8192 tokens for the open-access models). Requests exceeding this limit currently return a generic 500 Internal Server Error rather than a descriptive error, so prune your history proactively rather than relying on the API to reject oversized requests gracefully.
Key-gated models (Enterprise API)
Larger models run behind a separate, OpenAI-compatible endpoint and need an API key. Get a free key (no credit card needed) on the Enterprise page, or from your terminal:
curl -X POST "https://nukerhugo.nl/ai/enterprise/api/?endpoint=signup" \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com"}'Your key is shown once and only a hash is stored, so save it. There is one free key per email address.
curl https://nukerhugo.nl/ai/enterprise/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Hello!"}]}'With any OpenAI library, set the base URL to https://nukerhugo.nl/ai/enterprise/api/v1 and use your key as the API key. To check your remaining budget:
curl "https://nukerhugo.nl/ai/enterprise/api/?endpoint=usage" \
-H "X-API-Key: YOUR_KEY"The usage endpoint returns your plan, daily budget, tokens used and tokens remaining.
| Model | Context window | Access |
|---|---|---|
deepseek-v4-flash | 1M tokens | Included with every key. It thinks before it answers, and that thinking counts towards your daily token budget. |
qwen3.8-flash-next | 256K tokens | Availability varies. Contact sales to use it. |
| Limit | Details |
|---|---|
| Daily token budget | Free: 100,000 tokens per key per day. Partner plans are agreed per contract. Prompt, generated and thinking tokens all count. |
| Reset | Every day at 00:00 UTC. When a budget is used up, requests get HTTP 429 until then. |
| Per request | No fixed limit on answer length. A single request is cut off at whatever is left of your daily budget. |
| Request time | Requests without streaming time out after 5 minutes. For long answers, use streaming. |
Models run on shared hardware, so responses can be slower at busy times. Key-gated models are not returned by ?endpoint=models.
Success response
On success, the API returns HTTP 200 OK with a JSON object containing the model name and the assistant's reply.
| Field | Type | Description |
|---|---|---|
model | string | The model that generated the reply. |
message.role | string | Always assistant. |
message.content | string | The model-generated text response to the prompt. |
usage.prompt_tokens | integer | Number of tokens in the input (all messages combined). |
usage.completion_tokens | integer | Number of tokens in the generated reply. |
usage.total_tokens | integer | Sum of prompt and completion tokens. |
{
"model": "qwen-1.5b",
"message": {
"role": "assistant",
"content": "Paris is the capital of France."
},
"usage": {
"prompt_tokens": 45,
"completion_tokens": 12,
"total_tokens": 57
}
}Error response
When the request cannot be fulfilled, the API returns a non-200 HTTP status code along with a JSON object describing the failure. The shape of detail varies by error type: a plain string for method, model, and endpoint errors, or an array of validation-error objects for malformed/incomplete request bodies.
| Field | Type | Description |
|---|---|---|
detail | string | array | A human-readable description of what went wrong, or (for 422 responses) a list of field-level validation errors. |
{
"detail": "Model 'nonexistent-model' not found."
}{
"detail": [
{
"type": "missing",
"loc": ["body", "messages"],
"msg": "Field required"
}
]
}HTTP status codes
The API uses standard HTTP status codes to indicate the outcome of each request. Always check the HTTP status code before parsing the response body.
| Code | Status | Meaning |
|---|---|---|
| 200 | OK | The request was successful. |
| 400 | Bad Request | The endpoint query parameter is missing or did not match a known action. |
| 404 | Not Found | The requested model value does not match an available model. See List Models for valid values. |
| 405 | Method Not Allowed | The request used the wrong HTTP method for the chosen endpoint (e.g. GET on chat). |
| 422 | Unprocessable Entity | The request body was missing a required field or contained invalid JSON. The response detail field lists the specific validation errors. |
| 429 | Too Many Requests | Enterprise API only: the key's daily token budget is used up. It resets at 00:00 UTC. See Key-gated models. |
| 500 | Internal Server Error | Inference failed — most commonly because the combined message history exceeded the model's context window (see Multi-turn conversations). Retrying after a short delay may resolve transient failures, but oversized requests will continue to fail until trimmed. |
Code examples
Ready-to-use implementations in four languages, using the full (non-streaming) chat endpoint.
curl -X POST "https://nukerhugo.nl/ai/api/index.php?endpoint=chat" \
-H "Content-Type: application/json" \
-d '{"model":"qwen-1.5b","messages":[{"role":"user","content":"Hello, who are you?"}]}'async function askLLM(model, messages) {
const res = await fetch('https://nukerhugo.nl/ai/api/index.php?endpoint=chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ model, messages }),
});
const data = await res.json();
if (!res.ok) {
throw new Error(data.detail);
}
return data.message.content;
}
// Usage
askLLM('qwen-1.5b', [{ role: 'user', content: 'Tell me a joke' }]).then(console.log);import requests
def ask_llm(model: str, messages: list) -> str:
response = requests.post(
"https://nukerhugo.nl/ai/api/index.php",
params={"endpoint": "chat"},
json={"model": model, "messages": messages},
)
response.raise_for_status()
data = response.json()
return data["message"]["content"]
# Usage
reply = ask_llm("qwen-1.5b", [{"role": "user", "content": "Explain quantum entanglement briefly."}])
print(reply)function ask_llm(string $model, array $messages): string {
$ch = curl_init('https://nukerhugo.nl/ai/api/index.php?endpoint=chat');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['model' => $model, 'messages' => $messages]),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$data['message']) {
throw new Exception($data['detail'] ?? 'Unknown error');
}
return $data['message']['content'];
}
// Usage
echo ask_llm('qwen-1.5b', [['role' => 'user', 'content' => 'What is 2 + 2?']]);Try it
Send a live request to the API directly from this page and inspect the response in real time.
This console sends a real request to the production model server with each click. Please use it sparingly rather than repeated submissions.
Known limitations
Worker pool processing
Requests are handled by a pool of workers, so multiple requests are typically processed in parallel rather than one at a time. During traffic spikes, requests beyond available worker capacity are queued and may see increased latency. There is currently no mechanism to check queue depth or expected wait time — check live status for current reachability.
Per-model context window
Each model has a fixed maximum combined token length across prompt (or full message history) and response — check context_window from List Models rather than assuming a single number for all models. There is no dynamic context expansion. Token counts are approximate and vary by content.
Availability
The service is provided as-is and as available. Models may be changed or removed at any time, and rate limits may be applied with or without notice. See the Terms.
These constraints are fixed at the infrastructure level and are not configurable via request parameters.