Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Server quickstarts

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:

  1. authenticates with an API key,
  2. discovers the models installed on your server (GET /v1/models),
  3. streams a chat completion token by token,
  4. 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.


Prerequisites

  1. AI Server, running. Install it from the Microsoft Store, open it, and start the server (either "This session" or as a Windows service).
  2. 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.
  3. 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

Run it

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?"

Configuration

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.


What these examples teach

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

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.

Learn more

Licence

MIT — copy any of this into your own project.

About

Minimal, dependency-free examples of calling the OpenAI-compatible API of Software Tailor AI Server — curl, Python, Node.js, C#/.NET, PowerShell

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages