# OpenCode

Configure OpenCode to use Blaschke through an OpenAI-compatible provider. Your API key remains in your environment.

## Copy the setup prompt.

Give this to OpenCode itself or another project agent. It backs up existing settings and checks only model metadata.

### OpenCode setup prompt

```text
Set up OpenCode on this computer to use Blaschke through its OpenAI-compatible provider.

- Base URL: https://beta.blaschkelabs.com/v1
- Model: read the exact ID from BLASCHKE_MODEL. If it is missing, ask me to choose one returned by model discovery.
- API key: in BLASCHKE_API_KEY. Never print it, save it in source or chat, or ask me to paste it here.
- The selected model's inference worker must be configured separately.

Do this:
1. Open ~/.config/opencode/opencode.json. If it exists, back it up first, then merge a blaschke entry under providers using @opencode/ai/providers/openai-compatible while keeping everything else. Register the exact BLASCHKE_MODEL ID and use its context, output and preview-rate metadata from GET /v1/models. Do not invent limits or model capabilities.
2. If OpenCode is not installed, point me to the current installation method at https://opencode.ai. Do not install anything without asking.
3. If the client key is not set, tell me to provide it privately in my own shell.
4. Check the key and list available models without inference:
curl --fail --silent --show-error https://beta.blaschkelabs.com/v1/models \
  -H "Authorization: Bearer $BLASCHKE_API_KEY" \

5. Do not start OpenCode or send a chat request unless I ask. Tell me what you changed and how to launch it myself.

Use the exact selected model ID and do not substitute another model or assume another model's compatibility settings.
```

## Or configure it manually.

Install OpenCode using the current method at `https://opencode.ai/docs/`. Merge this configuration into `~/.config/opencode/opencode.json` while preserving unrelated settings.

### ~/.config/opencode/opencode.json

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "blaschke/qwen3.8-27b-rana-abliterated-fp8",
  "providers": {
    "blaschke": {
      "name": "Blaschke",
      "env": [
        "BLASCHKE_API_KEY"
      ],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://beta.blaschkelabs.com/v1"
      },
      "models": {
        "qwen3.8-27b-rana-abliterated-fp8": {
          "name": "Qwen3.8 · 27B RANA · FP8",
          "limit": {
            "context": 153600,
            "output": 16384
          },
          "cost": {
            "input": 0.3,
            "output": 0.3
          }
        },
        "inkling-2-mini-uncensored-gguf": {
          "name": "Inkling 2 Mini · Uncensored",
          "limit": {
            "context": 32768,
            "output": 8192
          },
          "cost": {
            "input": 0.3,
            "output": 0.3
          }
        },
        "qwen3.6-35b-a3b-abliterated-gguf": {
          "name": "Qwen3.6 · 35B-A3B Abliterated",
          "limit": {
            "context": 32768,
            "output": 16384
          },
          "cost": {
            "input": 0.3,
            "output": 0.3
          }
        }
      }
    }
  }
}
```

- OpenCode resolves the provider credential from `BLASCHKE_API_KEY`; the JSON contains only the environment variable's name.
- The default `model` selects Qwen3.8. Change it to another `blaschke/<model-id>` entry, or run `/models` inside OpenCode.
- Configure `small_model` separately if you want a different model for lightweight tasks.

### Export credentials and check without inference

```shell
export BLASCHKE_API_KEY="blsk_..."
curl --fail --silent --show-error https://beta.blaschkelabs.com/v1/models \
  -H "Authorization: Bearer $BLASCHKE_API_KEY" \
```

### Start OpenCode when you are ready

```shell
opencode
```

## Notes.

Client configuration does not replace model discovery or worker setup.

- The `env` entry names `BLASCHKE_API_KEY`; it does not store the key in the file.
- Context and output limits are client configuration values; explicitly bound output for each task.
- This configures OpenCode's model provider, not its plugins or server API.

## Related guides

- [Verified Pi path](https://beta.blaschkelabs.com/docs/agents/coding-agents/pi): Review the tested read-only tool-call workflow.
- [Limits and compatibility](https://beta.blaschkelabs.com/docs/limits): Check request limits and supported fields.

Source: https://beta.blaschkelabs.com/docs/agents/coding-agents/opencode

Markdown: https://beta.blaschkelabs.com/docs/md/agents/coding-agents/opencode.md
