Authentication

All API requests require an API key. Create one from the API Keys page.

Pass your key using either header:

Authorization: Bearer YOUR_API_KEY
# or
X-Api-Key: YOUR_API_KEY

Rate Limits

Chat completion requests are rate limited to protect server capacity. Integrations should handle 429 Too Many Requests responses and retry after a short delay.

  • 10 requests/minute per API key
  • 1 concurrent request per API key
  • 2 concurrent requests across all keys (server-wide)

The GET https://llm.saaclabs.com/v1/models endpoint is not rate limited. Only POST https://llm.saaclabs.com/v1/chat/completions counts toward these limits.

Rate limit response

HTTP/1.1 429 Too Many Requests
Retry-After: 60

{
  "error": {
    "message": "Rate limit exceeded. Maximum 10 requests per minute per API key.",
    "type": "rate_limit_error"
  }
}

Chat Completions

Create a chat completion using the OpenAI-compatible endpoint.

POST https://llm.saaclabs.com/v1/chat/completions

Request body

{
  "model": "llama3.1:8b",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Hello!" }
  ],
  "temperature": 0.7
}

Example

curl https://llm.saaclabs.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.1:8b",
    "messages": [{"role": "user", "content": "Summarize quantum computing in one sentence."}]
  }'

Response

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "llama3.1:8b",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Quantum computing uses quantum bits..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 24,
    "total_tokens": 36
  }
}
Long requests: For prompts that take several minutes, send "stream": true. Tokens arrive incrementally and avoid client-side idle timeouts. Non-streaming calls may need a client timeout of at least 10 minutes for large models.

List Models

Returns available Ollama models on this server.

GET https://llm.saaclabs.com/v1/models

Currently available

  • llama3.2:3b
  • llama3.1:8b

Code Examples

C# (.NET)

var client = new OpenAIClient(
    new ApiKeyCredential("YOUR_API_KEY"),
    new OpenAIClientOptions { Endpoint = new Uri("https://llm.saaclabs.com/v1") });

var chat = client.GetChatClient("llama3.1:8b");
var response = await chat.CompleteChatAsync("Hello!");
Console.WriteLine(response.Value.Content[0].Text);

Python

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://llm.saaclabs.com/v1"
)

response = client.chat.completions.create(
    model="llama3.1:8b",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

JavaScript

const response = await fetch("https://llm.saaclabs.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "llama3.1:8b",
    messages: [{ role: "user", content: "Hello!" }]
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);