Documentation Overview GitHub

Native Swift / MLX / 4D

Local inference. Built for your Mac.

Bring local AI into your application with Swama. Run models on Apple Silicon, serve chat and embeddings over HTTP, and connect from 4D or your own client.

The local stackOn your machine
Your applicationAI Kit or your own HTTP client
HTTP / 127.0.0.1:8080
SwamaNative Swift / MLX server
loads
A model you chooseMatched to your task and memory; loaded from an MLX model directory
Local inference. A familiar HTTP interface.

Apple Silicon · macOS 15.4+ · Model weights downloaded separately

Apple Silicon native arm64 server Swift + MLX Metal-accelerated inference 4D 20+ component integration Local HTTP chat and embeddings

Choose your starting point

One engine. Two ways in.

Before you begin

Made for Apple Silicon.

Hardware, software and model requirements
You bringWhat to know
An Apple Silicon MacmacOS 15.4 or newer. These native builds do not support Intel Macs, Windows or Linux.
A compatible MLX modelChoose a model that fits your memory and task. Check its license and instructions. Weights are not included in the download.
4D 20+ for integrationInstall the Swama component and its declared dependencies. Direct CLI/HTTP use does not require 4D or Xcode.

Ready to run

Download. Keep the whole engine.

Verified component release

Swama for 4D 20.1.6

Includes the source-built Swama CLI 2.5.1, MLX kernels and required runtime resources. Developer ID signed and Apple notarization Accepted.

The DMG has a validated stapled notarization ticket. The ZIP contains the same signed component.

Copy the complete swama.4dbase folder from the disk image or ZIP. For 4D, follow the component installation guide. For standalone use, open Resources/bin/macOS inside that folder.

Prefer a source-build CLI artifact? See the native build guide. Those standalone Actions packages are ad-hoc signed, unlike the signed component download above.

From download to conversation

Your first local request.

This path uses the CLI directly, without starting 4D. If the component is already managing a server on port 8080, use that server instead of starting another one.

01

Choose and download a model

Shell / macOS

Replace the folder path with your extracted download. The qwen3 alias downloads a chat model; allow time and disk space for the weights.

cd "/path/to/swama.4dbase/Resources/bin/macOS"
shasum -a 256 --check SHA256SUMS
./swama --version
./swama pull qwen3
02

Start the engine on localhost

Shell / macOS
./swama serve --host 127.0.0.1 --port 8080

Leave it running. In another terminal, wait until model discovery returns HTTP 200. This confirms HTTP readiness, not that model inference has already completed.

curl --fail http://127.0.0.1:8080/v1/models
03

Start a conversation

Shell / macOS
curl --fail http://127.0.0.1:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3",
    "messages": [{"role": "user", "content": "Hello from my Mac."}],
    "max_tokens": 128,
    "stream": false
  }'

The first inference may take longer while the model loads. For streaming, use curl -N and set "stream": true. Stop a foreground server with Control-C.

Connect with tools you know

A familiar API. A local address.

Point AI Kit's OpenAI client at your running server. Use a model identifier returned by /v1/models; the 4D guide's custom model is not the CLI's qwen3 alias.

var $AIClient : cs.AIKit.OpenAI
$AIClient:=cs.AIKit.OpenAI.new()
$AIClient.baseURL:="http://127.0.0.1:8080/v1"
Swama endpoint compatibility
CapabilityEndpointWhat to know
Model discovery/v1/modelsSupported
Chat completions/v1/chat/completionsVision and function-tool calling depend on the selected model.
Embeddings/v1/embeddingsA separate embedding model is required.
Responses/v1/responsesPartial OpenAI compatibility; not a full replacement.
Audio/v1/audio/transcriptions, /v1/audio/speechSuitable audio models are required.
Images, moderation, filesGeneration, moderation and uploadsNot provided by this integration.

Tool calls are returned to your client, not executed by the server. Follow the selected model's instructions; no blanket 4-bit-only restriction or manual config.json edit is prescribed.

See embedding and 4D examples →

Go a little further

From first request to your application.

Manage the server from 4D, configure its environment or inspect exactly how the native distribution was built.