Documentation

Fylun Code

A coding agent that runs in your terminal, powered by your Fylun subscription. Every frontier model, one browser login, one wallet — no API keys to buy, no per-provider accounts to juggle.

01

Install

One small binary — no runtime to install. Pick your platform.

macOS & Linux
bash
curl -fsSL fylun.ai/code/install | bash
Windows (PowerShell)
powershell
powershell -NoProfile -Command "irm fylun.ai/code/install.ps1 | iex"
Homebrew
bash
brew install usefylun/tap/fylun-code
Scoop (Windows)
powershell
scoop bucket add fylun https://github.com/usefylun/scoop-bucket
scoop install fylun-code
02

Sign in

Launch the agent and sign in once through your browser — there are no API keys to copy around for the CLI itself. Your tokens stay on your machine.

bash
fylun-code

This opens the TUI and, on first run, a browser login at fylun.ai. To manage or re-authenticate providers later, use:

bash
fylun-code auth
You can revoke access for any device from Settings → Security.
03

Configure

Global config lives at ~/.config/fylun-code/fyluncode.jsonc. It is seeded once on install and holds your defaults and the Fylun provider endpoint — the model catalog itself is baked into the binary, so upgrades keep it current.

jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "theme": "palenight",
  // The model the agent uses by default.
  "model": "fylun/deepseek-v4-flash",
  // Cheaper model for side-tasks (titles, summaries).
  "small_model": "fylun/gemini-3.1-flash-lite"
}

Set model to any id from the catalog (in provider/model form, e.g. fylun/claude-sonnet-5).

04

Commands

  • fylun-code — launch the full terminal UI in the current project.
  • fylun-code -m provider/model — start with a specific model.
  • fylun-code --continue — resume your last session.
  • fylun-code run "…" — one-shot: run a single prompt non-interactively, for scripts and CI.
  • fylun-code models — list every model available to your account.
  • fylun-code mcp — manage Model Context Protocol servers.
  • fylun-code upgrade — update to the latest version.
bash
# switch model and resume the last session
fylun-code -m fylun/claude-sonnet-5 --continue

# one-shot task from a script
fylun-code run "write a changelog entry for the last commit"
05

Models & pricing

Every model in your Fylun subscription is available in the CLI, and you can switch mid-session. Usage is billed to the same wallet at Fylun's flat markup — the same price you see on the models page. There is nothing separate to pay for and no per-provider key to manage.

Set a cheap small_modelin your config so background work (session titles, compaction summaries) doesn't run on a frontier model at frontier prices.

06

API access

Fylun exposes an OpenAI-compatible API, so the same wallet powers your own scripts, agents, and any tool that speaks the OpenAI format (Fylun Code, opencode, Crush, Cursor, the OpenAI SDKs).

  • Base URLhttps://fylun.ai/api/v1
  • AuthAuthorization: Bearer fyl_…
Create a key under Settings → Security → API keys. Keys start with fyl_, are shown once, and can be revoked anytime (up to 10 active).
List models
bash
curl https://fylun.ai/api/v1/models \
  -H "Authorization: Bearer $FYLUN_API_KEY"
Chat completion
bash
curl https://fylun.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $FYLUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [{ "role": "user", "content": "Hello from Fylun" }]
  }'
OpenAI SDK (JavaScript)
javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.FYLUN_API_KEY,
  baseURL: "https://fylun.ai/api/v1",
});

const res = await client.chat.completions.create({
  model: "gpt-5.6-terra",
  messages: [{ role: "user", content: "Hello from Fylun" }],
});
console.log(res.choices[0].message.content);
OpenAI SDK (Python)
python
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["FYLUN_API_KEY"],
    base_url="https://fylun.ai/api/v1",
)

res = client.chat.completions.create(
    model="gemini-3.6-flash",
    messages=[{"role": "user", "content": "Hello from Fylun"}],
)
print(res.choices[0].message.content)

Requests are billed to your wallet at the same markup as the app. Streaming is supported with "stream": true.

07

Upgrade & troubleshooting

bash
fylun-code upgrade
The model list still shows something old after upgrading

Fully quit any running fylun-code session and relaunch. The agent runs a background server that loads its config and catalog once at startup, so a running instance keeps its old list until you restart it. Run fylun-code models in a fresh shell to confirm the current catalog.

Reset the agent

Use fylun-code debug for troubleshooting tools, or delete ~/.config/fylun-code/fyluncode.jsonc to re-seed a fresh default config on the next launch.