APIMaster.ai

OpenCode with APIMaster.ai

Add APIMaster as an OpenAI-compatible provider in OpenCode Desktop, with optional Reasoning tiers via opencode.jsonc.

OpenCode Desktop is the graphical client for OpenCode (currently beta): local agent sessions, file edits, and shell execution. APIMaster.ai is OpenAI-compatible — add it under Settings → Providers → Custom provider.

Get your API Key first. Use placeholder your_apimaster_key below; screenshots mask real keys.


Prerequisites

  1. OpenCode Desktop installed from opencode.ai/download.
    • Windows: opencode-desktop-win-x64.exe
    • macOS: brew install --cask opencode-desktop or .dmg
    • Linux: .deb / .rpm / AppImage
  2. APIMaster API Key from the console.

Step 1 — Open Providers

  1. Launch OpenCode Desktop and open a workspace.
  2. Click the gear icon (bottom-left).
  3. Select Providers in the sidebar.
  4. Scroll to Custom provider (Add an OpenAI-compatible provider by base URL).
  5. Click + Connect.

Settings → Providers → Custom provider


Step 2 — Custom provider form

Field Value
Provider ID apimaster
Display name APIMaster.ai
Base URL https://apimaster.ai/v1
API key Your APIMaster key

Custom provider form

Leave Headers empty unless you authenticate via headers only.


Step 3 — Add models & Submit

On the next screen, map models (left = label in OpenCode, right = model id sent to APIMaster — usually the same):

Left Right
gpt-5.4 gpt-5.4
claude-sonnet-4-6 claude-sonnet-4-6
  1. Click + Add model for more rows.
  2. Click Submit.

Add models and Submit

Pick ids from the marketplace. Avoid image-only models (e.g. gpt-image-2) for agent chat.


Step 4 — Pick a model

  1. Start or open a session.
  2. Open the model dropdown below the input.
  3. Under APIMaster.ai, select a model (e.g. claude-sonnet-4-6).

Model picker


Step 5 — Test

Send hello or a small coding task. A normal Assistant reply (file edits / shell) means APIMaster is connected.

Chat test


Advanced: opencode.jsonc & Reasoning

The UI flow above is enough for a quick start. To configure Reasoning / thinking effort tiers (low, high, max, …) for the same model id, edit opencode.jsonc.

Config file location

OS Path
macOS / Linux ~/.config/opencode/opencode.jsonc
Windows C:\Users\<username>\.config\opencode\opencode.jsonc

Create the file if missing. Restart OpenCode Desktop or start a new session after saving.

API Key (do not put in jsonc)

Do not store your API Key in opencode.jsonc.

Use:

  • /connect in the terminal, or
  • Settings → Providers → Connect Provider (same as Steps 1–2 above).

Keep secrets in OpenCode’s auth store; jsonc only defines provider, models, and Reasoning variants.

APIMaster provider in jsonc

Provider id: apimaster. npm package: @ai-sdk/openai-compatible.

baseURL must be:

https://apimaster.ai/v1

Not https://apimaster.ai/ — OpenCode appends /chat/completions. Without /v1 you get https://apimaster.ai/chat/completions404 Not Found.

Full example with Reasoning variants — download and overwrite OpenCode’s config:

  1. Download opencode.jsonc
  2. Overwrite (or save as):
    • macOS / Linux: ~/.config/opencode/opencode.jsonc
    • Windows: C:\Users\<username>\.config\opencode\opencode.jsonc
  3. Configure API Key via /connect or UI (never in jsonc).
  4. Restart OpenCode Desktop or start a new session.

Back up your existing file before overwrite, or merge only the provider.apimaster block.

Minimal shape:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apimaster": {
      "name": "APIMaster.ai",
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "https://apimaster.ai/v1" },
      "models": {
        "gpt-5.4": {
          "name": "gpt-5.4",
          "variants": {
            "low": { "reasoningEffort": "low" },
            "high": { "reasoningEffort": "high" }
          }
        }
      }
    }
  }
}

Reasoning principles

  • variants = multiple Reasoning tiers for one model id in the UI.
  • For OpenAI-compatible APIs, OpenCode maps reasoningEffortreasoning_effort in the request body.
  • Variant names should match the actual parameter (high"reasoningEffort": "high").
  • Each model supports different tiers — configure per official docs; no hidden remapping.

Reasoning tiers by model

Model Reasoning variants Notes
gpt-5.4 low, medium, high, xhigh GPT reasoning
gpt-5.5 low, medium, high, xhigh GPT reasoning
deepseek-v4-flash high, max DeepSeek thinking (recommended)
deepseek-v4-pro high, max DeepSeek thinking (recommended)
claude-sonnet-4-6 low, medium, high, max Claude Sonnet effort
claude-opus-4-7 low, medium, high, xhigh, max Claude Opus effort
claude-opus-4-8 low, medium, high, xhigh, max Claude Opus effort
claude-haiku-4-5 none No unconfirmed effort tiers
minimax-m3 none No unconfirmed effort tiers

See opencode.jsonc for the full file.

Switching Reasoning in OpenCode

  1. Save opencode.jsonc, then restart or new session.
  2. Use the model / Reasoning dropdown (e.g. gpt-5.4 / high).
  3. If supported in your build: Ctrl + Shift + D cycles Reasoning tiers.

Troubleshooting

UI setup

Issue Fix
401 Check key; rotate if exposed
Model not found Base URL must be https://apimaster.ai/v1; model id must match marketplace
No APIMaster models Edit provider in Settings → add mappings → Submit
Slow / timeout Try another model; use API Key Tester

Reasoning / jsonc

Why only high and max for DeepSeek?
Official OpenAI-compatible thinking effort for DeepSeek is high and max. Avoid low / medium / xhigh that get remapped unpredictably.

Why max for Claude Sonnet, not xhigh?
Sonnet’s top tier is max; xhigh is for Opus (claude-opus-4-7 / claude-opus-4-8).

Why no variants for Haiku or MiniMax M3?
Without documented reasoningEffort values, skip variants — the model still works; UI just won’t show Reasoning sub-tiers.

Still getting 400?

  1. baseURL = https://apimaster.ai/v1 (not site root).
  2. Model id spelling matches the marketplace.
  3. Key configured via /connect or UI.
  4. Remove variants temporarily — if plain requests work, the chosen reasoning_effort may be unsupported for that model.

Security

  • Never share keys in chat or unredacted screenshots.
  • Rotate keys that appeared in screenshots or logs.
  • OpenCode can read/write files and run shell commands — use trusted workspaces only.

Checklist

  • OpenCode Desktop installed
  • Custom provider connected or apimaster in opencode.jsonc
  • Base URL / baseURL = https://apimaster.ai/v1 (not https://apimaster.ai/)
  • API Key via /connect or UI (not in jsonc)
  • At least one chat model mapped
  • (Optional) Reasoning variants match official tiers
  • Test message succeeds

Summary

  • Keys: baseURL (https://apimaster.ai/v1), model id, API Key (/connect or UI), optional Reasoning variants.
  • Variant names = actual reasoning_effort values.
  • Configure tiers per model; skip variants when unsupported (Haiku, MiniMax M3).

See also