Files
2026-11-16 13:09:34 +00:00

3.3 KiB

AI Studio

AI Studio is a native SwiftUI chat app for Apple silicon Macs running macOS 14 or later. Open AIStudio.xcodeproj, select the shared AIStudio scheme, and run it on My Mac. Xcode resolves the pinned Swift packages on the first build. The command-line equivalents are ./build.sh Debug and ./test.sh.

Set up inference

  1. Open AI Studio → Settings. The default server is http://127.0.0.1:11434. Start Ollama, refresh installed models, and select a tag, or enter the tag directly. Pull, inspect, and delete models on the configured server from the same pane.
  2. To use a remote Ollama server, enter its HTTP or HTTPS base URL. The server receives your prompt and the selected conversation context. Use HTTPS with a trusted server for remote inference. The client rejects redirects and currently has no custom authentication headers.
  3. For native inference, choose a local MLX-compatible model folder containing configuration, tokenizer files, and safetensors weights. Use MLX only to force local generation, or keep Prefer Ollama to enable automatic MLX failover once a folder is configured. Unload Model releases the cached model.
  4. Choose Thinking in the chat composer. The app passes Boolean or named effort settings to Ollama and displays separately reported reasoning in an expandable section. Use Default when a model does not support the selected mode. Native MLX currently uses the model's template defaults and presents emitted text as answer text.

The router stays on the original backend after it receives answer text, thinking text, or a tool call. Stop cancels the request and saves partial output with an interrupted label. The fallback is always on this Mac. There is no automatic retry against a second remote server.

Chat and memory

Chats live in ~/Library/Application Support/AIStudio/studio.sqlite. Backend settings are stored in macOS preferences. Each request includes up to 32 recent messages. Optional memory recalls up to four older user messages in the same conversation through SQLite keyword matching. It can be switched off in Settings. Deleting a conversation removes its messages and recall candidates together.

Code and verification

  • Inference.swift defines streaming events, the routing policy and the MCP tool-client interface.
  • Ollama.swift implements HTTP model management and NDJSON chat streaming. MLXProvider.swift loads a local checkpoint and streams generated tokens through MLX Swift LM.
  • Store.swift owns SQLite operations. StudioModel.swift coordinates settings, routing and streaming state for SwiftUI.
  • ./test.sh runs the XCTest suite. Set the following environment variables to include local or remote Ollama and native MLX smoke tests. The models must already exist.
TEST_RUNNER_AISTUDIO_TEST_OLLAMA_URL=http://127.0.0.1:11434 \
TEST_RUNNER_AISTUDIO_TEST_OLLAMA_MODEL=your-installed-tag \
TEST_RUNNER_AISTUDIO_TEST_MLX_PATH=/path/to/local-model ./test.sh

MCP readiness currently consists of the tool-client interface and a routing commitment event. MCP transport, server discovery, tool approval UI and dispatch remain future work. The app also lacks an MLX download catalog and semantic or document retrieval.

API references: Ollama chat API, MLX Swift LM.