Getting started
New to Larik? Your first ten minutes is the short tour; the rest of this file is the reference.
On macOS or Linux, download a release, verify its checksum and install larik into ~/.local/bin:
curl -fsSL https://raw.githubusercontent.com/vwibowo/larik/main/scripts/get-larik.sh | sh
Set LARIK_VERSION (for example v0.7.0) to pin a release, or LARIK_INSTALL_DIR to install elsewhere. On Windows, download the zip from the releases page.
To build from a checkout and install larik into /usr/local/bin:
./scripts/install.sh
The installer uses sudo when needed. Set PREFIX or BINDIR to install elsewhere, for example:
PREFIX="$HOME/.local" ./scripts/install.sh
To build without installing:
go build -o larik ./cmd/larik
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY / GEMINI_API_KEY
./larik
After installation, run larik from any directory.
The first time you run larik in a terminal with nothing configured, a setup wizard walks through connecting a model. It finds a running Ollama or LM Studio server and any API keys in your environment, tests the connection, lists the provider's models (with Ollama, it can also download a recommended model, or any model you name, with a progress bar), and saves your choice to ~/.config/larik/config.json or private project settings under ~/.config/larik/projects/. Run /connect at any time to add another provider.
With no --model and no saved default, Larik picks the default model of the first provider whose key is set:
| Key | Default model |
|---|---|
ANTHROPIC_API_KEY |
anthropic/claude-opus-5 |
OPENAI_API_KEY |
openai/gpt-5.5 |
GEMINI_API_KEY |
gemini/gemini-3.8-flash |
./larik --model openai/gpt-5.5
./larik --model ollama/qwen3-coder
./larik --model openrouter/anthropic/claude-sonnet-5
./larik -p "summarize this repo" # headless, text output
./larik -p --output json --mode yolo "run tests" # one JSON event per line
./larik -p --timeout 10m "refactor the parser" # stop an unattended run after 10 minutes
./larik -p --output-schema schema.json "list the open TODOs" # final answer as JSON matching the schema
./larik -c # continue the last session here
./larik --resume 20260926-2358 # resume by id prefix
./larik -c --fork # branch the last session instead of appending
./larik serve # HTTP + SSE API (see Server mode)
./larik bench --models worker,anthropic/claude-haiku-4-5 # compare models on self-checking tasks (see Mixing cheap and strong models)
--output-schema takes a JSON Schema, inline or as a file path. The model is told the schema, and its final answer must be a JSON value that matches it. If it doesn't, the model is shown the validation error and gets two more tries; after that Larik exits with an error. Stdout then carries only the value, on one line, so it can be piped into jq. With --output json, the events stream as usual and end with {"type":"structured_output","output":…}. It works with every provider.
ChatGPT plan (Codex models)
To use Codex models on your ChatGPT plan instead of an API key, run /connect codex (or pick "ChatGPT (Codex)" in the first-run wizard). larik opens the ChatGPT sign-in page in your browser and receives the result on localhost:1455, the same OAuth flow the Codex CLI uses. It keeps its own sign-in in ~/.config/larik/chatgpt-auth.json, readable only by you, refreshes it before it expires, and never touches the Codex CLI's login. Sign out from /providers (select codex, press d twice).
To use a Claude subscription through the official CLI, install Claude Code and sign in with claude auth login, then run /connect claude-code-cli. /model lists the models your Claude subscription can actually use, with the same names and descriptions Claude Code shows, and offers each one only the effort levels it accepts. larik asks the CLI itself, which answers from local state without starting a turn, sending a prompt, or spending tokens; only the model list is read from its reply. An older CLI that won't answer falls back to the rolling sonnet, opus, and fable aliases, and you can always enter a full model ID such as claude-code-cli/claude-opus-5. Claude Code reports which concrete model each name resolves to, so the context meter uses that model's real window — 200k for Haiku where Sonnet has 1M. Your turn stays attributed to the name you picked, and cost stays unreported because it bills your subscription rather than tokens. Larik checks the CLI version, required flags, and first-party sign-in. It leaves authentication with Claude Code and removes API-key and cloud-provider routing variables from inference child processes. Context compaction is managed by Claude Code, so Larik's /compact command is unavailable for this provider. anthropic/<model> remains the API-key provider; claude-code-cli/<model> runs Claude Code as the agent and routes tool calls through Larik's permission and hook checks.
For NVIDIA's hosted model catalog, run /connect nvidia-nim and enter a key, or set NVIDIA_API_KEY; for example, select an available nvidia-nim/<model-id> after connection. NVIDIA's developer access is for prototyping, research, development, and testing. Self-hosted NIM can use a custom OpenAI-compatible provider instead. Gemini and anthropic/<model> use API keys.
./larik --model codex/gpt-6-luna # the fast, affordable one; good for testing
Local models with Ollama
Ollama loads models with a small context window by default (4096 tokens), and Larik's system prompt and tool definitions alone use most of that. Larik talks to Ollama through its native chat API and asks for a 32768-token window (num_ctx), or the model's own maximum if that is smaller, so no server setting is needed.
A larger window uses more memory for the model's KV cache. To change it, set context_length for the provider in ~/.config/larik/config.json:
{ "providers": { "ollama": { "context_length": 65536 } } }
Larik reads back the window Ollama actually loaded, uses it for the context percentage and compaction, and warns when a request fills it. It also warns if the chosen model can't call tools. Small models such as qwen3:4b handle simple read/edit/test loops but can be unreliable with delegation.
Tool calls written as text. A local server that doesn't apply a model's tool template leaves the call in the reply, as <tool_call>{"name": ..., "arguments": {...}}, instead of returning it as a tool call. Larik recovers one rather than ending the turn on markup, never shows you the markup — the prose before it streams as usual, and nothing from the opening tag onward is displayed, even when the tag arrives split across chunks — and says that it did — the real fix is the server's configuration (llama.cpp's --jinja, vLLM's --enable-auto-tool-choice), so the notice names it. Only an explicitly delimited call whose name is a tool that was actually offered is recovered, so a model quoting an example, or discussing JSON, doesn't cause one to run; a recovered call goes through the same permission checks as any other. A reply that already carries a proper tool call is left alone. This applies to Ollama and OpenAI-compatible endpoints; the first-party APIs always return tool calls as tool calls. Ollama with Qwen3 converts them correctly, so you are unlikely to see this there.
Local speech (STT and TTS)
Larik can transcribe and speak through a local command, with no server to keep running, or through any server that implements the OpenAI audio API. Both are independent from Larik's chat model.
Audio is disabled by default and is configured in your personal ~/.config/larik/config.json. The simplest setup on macOS uses whisper.cpp for speech-to-text and the built-in say voice for text-to-speech:
brew install whisper-cpp ffmpeg
mkdir -p ~/models && curl -L -o ~/models/ggml-small.bin \
https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin
{
"audio": {
"enabled": true,
"stt": { "command": "whisper-cli -m ~/models/ggml-small.bin -nt -np -l \"${LARIK_STT_LANGUAGE:-auto}\" -f", "language": "id" }
}
}
A command replaces the endpoint for that direction. Larik runs it with sh -c and appends a temporary WAV path as the final argument, the same way it runs record_command and play_command:
- An STT command reads that 16 kHz mono WAV and prints the transcript on stdout (plain text, or a JSON object with a
textfield).LARIK_STT_LANGUAGEholds the current STT language, which/stt-languagechanges, or is empty. If the command exits non-zero, the end of its stderr is shown; a transcript of only markers such as[BLANK_AUDIO]counts as no speech. The model loads on every recording, which takes about half a second for whisper.cpp'ssmallmodel on Apple Silicon. - A TTS command reads the text on stdin and writes speech to that WAV path.
LARIK_TTS_VOICEholdstts.voice. - With no TTS
commandorbase_url, macOS usessay, so/speakworks without setup. Settts.voiceto any voice listed bysay -v '?'. Other platforms need a TTS command or endpoint, such aspiper --model en_US-lessac-medium.onnx --output_file.
Commands run as local processes outside the bash sandbox, so like the rest of the audio section they come only from personal settings.
To keep a model loaded between recordings, run a server instead. Speech-to-text uses POST /v1/audio/transcriptions and text-to-speech uses POST /v1/audio/speech. Qwen3-ASR, whisper.cpp's whisper-server (started with --inference-path /v1/audio/transcriptions) and Speaches all provide STT. TTS needs a separate model such as Qwen3-TTS or Kokoro:
{
"audio": {
"enabled": true,
"stt": { "base_url": "http://127.0.0.1:8000/v1", "model": "Qwen3-ASR-1.7B", "language": "id" },
"tts": { "base_url": "http://127.0.0.1:8001/v1", "model": "Qwen3-TTS-0.6B", "voice": "default" },
"max_duration_seconds": 120,
"auto_speak": false
},
"keybindings": { "record_audio": "ctrl+space" }
}
Press ctrl+space to start/stop recording. While the mic is active, the TUI temporarily replaces the composer with an animated, decorative equalizer, elapsed time, and the stop-key hint (the bars do not measure actual microphone volume). Your draft is preserved; typing and pasting into the hidden composer are paused until transcription finishes and the composer returns. The transcript is inserted into the composer for review. Set the optional STT language to an ISO-639-1 code such as id to guide language detection and transcription; compatible servers that return a JSON transcription object are normalized to its text field. Use /stt-language id or /stt-language en to switch between Indonesian and English, or /stt-language auto to clear it and let the model detect the language; /stt-language shows the current setting. Use /speak to synthesize the latest assistant reply, or /speak some text for explicit text. Set auto_speak to true to play every completed top-level reply. Recording uses ffmpeg by default (macOS uses AVFoundation; Linux uses PulseAudio), and playback uses afplay on macOS or ffplay on Linux. Set record_command or play_command when your platform uses different commands; Larik appends the temporary WAV path as the final shell argument.
For an endpoint that requires authentication, set api_key directly in personal settings or prefer api_key_env with an environment-variable name such as LOCAL_AUDIO_API_KEY; then export that variable before starting Larik. Omit both for an unauthenticated local server. max_duration_seconds limits how long one recording can run (the default is 120 seconds). Only personal settings can enable audio because it accesses the microphone, launches local processes, and sends recordings to the configured endpoint. A shared project settings file may disable it but cannot enable or configure it.