Connect an agent

SwymbyAI speaks the OpenAI API. Anything that can talk to OpenAI — SDKs, LangChain, n8n, your own agent loop — connects by changing two settings: the base URL and the API key.

✓ You're logged in — every example below already contains your real API key. Copy & run.
1

The two settings

Base URLhttps://api.llm.jasv.online/v1
API keysk-YOUR-API-KEY
Modelsqwen-tiny, qwen-small (depends on your tier)

Your key is on the dashboard. Check which models your tier includes:

bash
curl https://api.llm.jasv.online/v1/models \
  -H "Authorization: Bearer sk-YOUR-API-KEY"
2

First request

Python, with the official OpenAI SDK (pip install openai):

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llm.jasv.online/v1",
    api_key="sk-YOUR-API-KEY",
)

r = client.chat.completions.create(
    model="qwen-tiny",
    messages=[{"role": "user", "content": "Ahoj! Introduce yourself."}],
)
print(r.choices[0].message.content)

Node.js (npm install openai):

javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llm.jasv.online/v1",
  apiKey: "sk-YOUR-API-KEY",
});

const r = await client.chat.completions.create({
  model: "qwen-tiny",
  messages: [{ role: "user", content: "Ahoj! Introduce yourself." }],
});
console.log(r.choices[0].message.content);

Streaming works the standard way — pass stream: true and iterate the chunks.

3

A minimal agent loop

An agent is just a loop: the model answers or asks to use a tool; you run the tool and feed the result back. Here is a complete, runnable one:

python
import json
from openai import OpenAI

client = OpenAI(base_url="https://api.llm.jasv.online/v1",
                api_key="sk-YOUR-API-KEY")

def get_time(city: str) -> str:
    return f"In {city} it is 14:32."   # your real tool goes here

TOOLS = [{
    "type": "function",
    "function": {
        "name": "get_time",
        "description": "Get the current local time in a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

messages = [{"role": "user", "content": "What time is it in Prague?"}]

while True:
    r = client.chat.completions.create(
        model="qwen-small", messages=messages, tools=TOOLS)
    msg = r.choices[0].message
    messages.append(msg)

    if not msg.tool_calls:            # model answered — done
        print(msg.content)
        break

    for call in msg.tool_calls:       # model wants tools — run them
        args = json.loads(call.function.arguments)
        result = get_time(**args)
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": result,
        })
Honest note about the demo models: tool calling depends a lot on model size. qwen-small (1.5B) handles simple single-tool calls; qwen-tiny will often answer in prose instead of calling your tool. For production agents you'd run this exact code against the larger models on a Dedicated tier. The wire protocol — what you build against — is identical.
4

Frameworks

LangChain — use the OpenAI chat model with a custom endpoint:

python
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.llm.jasv.online/v1",
    api_key="sk-YOUR-API-KEY",
    model="qwen-small",
)
print(llm.invoke("Three facts about Brno, one line each.").content)

n8n — add an OpenAI credential, set its Base URL to https://api.llm.jasv.online/v1 and paste your key. Every OpenAI node (Chat Model, AI Agent) then runs against SwymbyAI.

Anything else (LlamaIndex, Vercel AI SDK, Continue, Open WebUI, …) — look for “OpenAI-compatible” or “custom base URL” in its settings; the same two values work everywhere.

5

Limits, errors & good citizenship

429 rate limitYou exceeded your tier's requests/min or tokens/min. Back off and retry; upgrade the tier for more.
Budget exceededMonthly plans include a token credit; when it's burned the API returns an error until the 30-day window resets.
403 model accessYour tier doesn't include that model — check /v1/models.
Context lengthDemo models accept ~2k tokens per request. Keep agent histories short, or summarize old turns.

Every request is metered per token — watch live spend on your dashboard, or experiment first in the playground.