Minimal, dependency-free examples of calling Software Tailor AI Server from five stacks. AI Server exposes an OpenAI-compatible HTTP API, so if you've called OpenAI before, this will look familiar — you're just pointing at your own machine instead.
Every example does the same four things, so you can read whichever language you already know:
- authenticates with an API key,
- discovers the models installed on your server (
GET /v1/models), - streams a chat completion token by token,
- handles the responses a real server actually returns — not just the happy path.
| Your stack | File | Dependencies |
|---|---|---|
| Shell | curl/chat.sh |
curl |
| Python | python/chat.py |
none (standard library) |
| Node.js | node/chat.mjs |
none (Node 18+, built-in fetch) |
| C# / .NET | dotnet/Program.cs |
none (HttpClient) |
| PowerShell | powershell/chat.ps1 |
none (5.1 and 7+) |
No SDK is required. If you'd rather use one, the official openai packages work unchanged — set
base_url to your server's /v1 and your AI Server key as the API key.
- AI Server, running. Install it from the Microsoft Store, open it, and start the server (either "This session" or as a Windows service).
- An API key. In AI Server go to API keys → Add key and copy it. A server that serves your network requires a key — it refuses to run unauthenticated.
- The base URL, shown at the top of AI Server's Server page. It always ends in
/v1:- same machine →
http://localhost:11436/v1 - another machine on your network →
http://192.168.1.42:11436/v1
- same machine →
export AISERVER_BASE_URL="http://192.168.1.42:11436/v1" # from AI Server's Server page
export AISERVER_API_KEY="ai-suite_..." # from AI Server -> API keys
cd python && python chat.py "Why is the sky blue?"Windows PowerShell:
$env:AISERVER_BASE_URL = "http://192.168.1.42:11436/v1"
$env:AISERVER_API_KEY = "ai-suite_..."
cd powershell; .\chat.ps1 "Why is the sky blue?"Other stacks:
cd node && node chat.mjs "Why is the sky blue?"
cd dotnet && dotnet run -- "Why is the sky blue?"
cd curl && ./chat.sh "Why is the sky blue?"| Variable | Required | Meaning |
|---|---|---|
AISERVER_BASE_URL |
yes | Base URL including /v1 |
AISERVER_API_KEY |
yes | Key from AI Server → API keys |
AISERVER_MODEL |
no | Skip discovery and use this model id |
Copy .env.example to .env for your own notes — never commit a real key.
Beyond "send a prompt, print a reply", each file handles what a production client has to:
Model ids are per-installation. They look like enginea/qwen2.5/1.5b or cloud-anthropic/claude-sonnet-4-5/latest,
and depend on what's installed on that server. Always call /v1/models rather than hard-coding an id;
these samples default to the first locally-hosted model they find.
Streaming is server-sent events. Each line is data: {json}, and the stream ends with data: [DONE].
Read the response as a stream — the common mistake is a client that buffers the whole body and so
appears to hang until the answer is complete.
The responses you must handle:
| Response | Meaning | What the samples do |
|---|---|---|
401 |
Missing/invalid key | Explain how to issue one — don't retry |
429 + X-AISuite-Upgrade: 1 |
Free-tier cap for generic (non-AI-Suite) clients | Stop and explain; retrying won't help |
429/503 + Retry-After |
Busy, or a model is loading | Wait that many seconds, then retry (bounded) |
X-AISuite-Backend |
Which engine served the request | Surfaced for troubleshooting |
"Could not reach …" / connection refused. Check AISERVER_BASE_URL ends in /v1. If the server is
on another machine, it must be set to serve your network (Server settings → Access → This network)
and allowed through its firewall — use Network diagnostics → Test connectivity on that machine,
which checks the port, the firewall rule and your network type, and can add the rule for you.
401 Unauthorized. The key is missing, wrong, or was revoked. Issue a fresh one in API keys.
Keys take effect immediately — no restart needed.
"The server reports no models". Install one from AI Server's Models page.
Browser JavaScript can't call the server. AI Server doesn't send CORS headers, so a page served from a different origin can't call it directly. Call it from your backend (as these samples do) or put a small proxy in front.
- AI Server API & clients documentation — the full endpoint reference: chat, embeddings, images, speech, transcription
- AI Server documentation
MIT — copy any of this into your own project.