# Visual UI editing with OpenCode, DeepSeek and GLM

> Use OpenCode as a visual UI editor on your running app with the model you pick, such as DeepSeek or GLM, and your own key. Your providers carry over.

GUIJam gives OpenCode a visual front end. Circle an element on your running app, describe the change, and OpenCode proposes live UI variants you preview in the page before anything is written.

[OpenCode](https://opencode.ai) is an open-source AI coding CLI that reaches many model providers. With GUIJam, it's how you use DeepSeek, GLM and other models with your own key.

## Set up

### Install it

```bash
npm install -g opencode-ai
```

### Add a provider key

```bash
opencode auth login
```

GUIJam needs at least one provider key. Until OpenCode has one, GUIJam shows it as not logged in.

### Choose it and a model

`init` lists your models with DeepSeek and GLM first, and marks free and image-capable ones. Or choose directly:

```bash
npx guijam provider use opencode --model deepseek/deepseek-chat
```

### Send a test request

`init` offers to send OpenCode one short request, to show that GUIJam can use the model you picked. It spends a few tokens. Run the same check any time:

```bash
npx guijam doctor --probe
```

> **OpenCode's free models don't work with GUIJam**
>
> OpenCode's own free models (the free `opencode/…` models) answer only OpenCode's own agents, not tools like GUIJam, so `init` doesn't list them. Free models from your own providers, such as a local LM Studio, are still listed.

## Listing models

```bash
npx guijam provider models opencode
```

This prints the models OpenCode can run with your keys, leaving out deprecated ones. Add `--json` for machine-readable output.

Before each request, GUIJam checks that OpenCode can still reach the model you saved. If it can't, say because you removed that provider's key, you get "OpenCode can't reach `<model>` with the keys it has." Add a key for that model's provider with `opencode auth login`, or pick another model with `npx guijam init`.

## Your OpenCode providers carry over

GUIJam reads the provider settings from your global OpenCode config, so custom providers, base URLs and providers you turned on or off work the same in GUIJam. It reads these files, and a later one wins for each provider:

1. `config.json`, `opencode.json` and `opencode.jsonc` in `~/.config/opencode/`, or in `$XDG_CONFIG_HOME/opencode/` when that's set. On Windows, `~` is `%USERPROFILE%`.
2. The file that `OPENCODE_CONFIG` points to.

Only the `provider`, `enabled_providers` and `disabled_providers` settings carry over. Your MCP servers, plugins, agents, permissions and instructions stay off, and a project's own `opencode.json` isn't read.

GUIJam never copies a literal secret. A key, token, password or `Authorization` header written straight into the config is left out. To use one with GUIJam, reference it as `{env:NAME}` or `{file:path}`, which carry over for OpenCode to resolve:

```json title="~/.config/opencode/opencode.json"
{
  "provider": {
    "deepseek": { "options": { "apiKey": "{env:DEEPSEEK_API_KEY}" } }
  }
}
```

## When OpenCode refuses a request

The widget repeats what OpenCode said, and tells you what to change:

| Message                                                                                                                                                                            | What to do                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| "OpenCode was refused: `<what OpenCode said>`." For example, an invalid key.                                                                                                       | Run `opencode auth login` and add a key for the provider of the chosen model, or pick another model with `npx guijam init`. Then retry. |
| "OpenCode was refused: Model access is disabled. Change model access at `<link>`."                                                                                                 | Your OpenCode account has this model turned off. Turn it on at that link, or pick another model with `npx guijam init`. Then retry.     |
| "OpenCode couldn't answer: `<what OpenCode said>`. Add credit to the account behind this model, or pick another model with: npx guijam init." For example, "Insufficient balance." | The key works but its account is out of credit. Top it up, or pick another model.                                                       |
| "OpenCode couldn't answer: Free usage limit reached. … OpenCode's free models only answer OpenCode's own agents, not tools like GUIJam."                                           | Pick a model you have a key or plan for with `npx guijam init`.                                                                         |

Every failed run is also logged in `.guijam/logs/gjd.log`, with the OpenCode version and the model. Account and session IDs in OpenCode's message are replaced with `redacted` there.

## Images depend on the model

Sketches and attached images need a model that can read images. With one that can't, GUIJam says "`<model>` can't read images, so sketches need a model that can. Pick another with: npx guijam init".

## How GUIJam runs it

GUIJam runs OpenCode under its own `guijam` agent, with every permission denied and an isolated config that holds only your [provider settings](#your-opencode-providers-carry-over). Your OpenCode setup stays as it is, and OpenCode can't change files. The `gjd` daemon applies the edits it returns.
