NoticeMiMo-V2.6 Flash is under maintenance and temporarily unavailable. MiniMax H3 video will be upgraded shortly; video generation is paused during the upgrade and expected back by 00:00 UTC on Monday, Nov 2. All other models are working normally.
NewDeepSeek V4.1 Flash and MiniMax M3.1 Flash are live
Inferway
Back to client guides
Client guides

OpenCode

Add Inferway as an OpenCode custom provider with @ai-sdk/openai-compatible.

Available

Use Inferway as a custom provider in OpenCode. Your account must have model access enabled before connecting.

Current Inferway catalog

Context window393,216
Sample max tokens131,072

Verified on 1.18.25, macOS 26.6.2 arm64, 2026-09-25: basic conversation, and file-read, file-edit and shell-command tool round trips against inferway/mimo-v2.6-flash.

Before you start

Install the named client using its official instructions. Pi here means the pi-mono coding agent; Hermes means Nous Research's Hermes Agent.

Once your Inferway account is activated, create a key under Console → API Keys. Use a dedicated key for this client; a project's monthly budget caps what it can spend. Both live and test prefixes use the same inference and billing path; test is an environment label, not a free or simulated inference mode.

Use an Inferway key for Inferway's endpoint. An OpenRouter key belongs to OpenRouter and cannot authenticate to this address.

Keep the key in the client's credential store or your local environment. Do not paste it into a prompt, screenshot, or committed configuration. These examples use bash/zsh on macOS or Linux.

Make the key available to this terminal

The prompt below hides your input and keeps the key out of shell history. Start the client from this same terminal; a separately opened app may not inherit this variable.

INFERWAY_API_KEYbash
printf 'Inferway API key: '
IFS= read -r -s INFERWAY_API_KEY
printf '\n'
export INFERWAY_API_KEY

Confirm the endpoint and model

Use the full model ID xiaomi/mimo-v2.6-flash. The Base URL ends in /v1 once; do not append /chat/completions to a Base URL setting. Check that the response below contains the model ID.

List modelsbash
curl --fail-with-body --silent --show-error --max-time 30 \
  'https://api.inferway.ai/v1/models' \
  -H "Authorization: Bearer $INFERWAY_API_KEY"

Create the scratch folder

OpenCode can load a project config from the project root (per-project config and custom paths are covered in the OpenCode configuration docs). Work in a scratch folder so the test never touches your daily settings or your global provider list.

The accepted live tests ran OpenCode CLI on macOS 26.6.2 arm64; the verification line at the top of this guide shows whether the selected model was tested. Check your own installed version before following along. git init just gives OpenCode a clean project root; no commit is needed for the check.

Scratch folderbash
# Scratch folder with a small read fixture
mkdir inferway-opencode-verify && cd inferway-opencode-verify && git init -q
printf 'nonce-7f3a9c\n' > read-tool-fixture.txt

Save the project config

Save this as opencode.json at the root of the scratch folder. The provider section keeps the public model ID as the model key; the composite model selector is provider/model. {env:INFERWAY_API_KEY} interpolates the variable set earlier; the key itself never enters the file.

opencode.jsonjson
{
  "$schema": "https://opencode.ai/config.json",
  "model": "inferway/xiaomi/mimo-v2.6-flash",
  "provider": {
    "inferway": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Inferway",
      "options": {
        "baseURL": "https://api.inferway.ai/v1",
        "apiKey": "{env:INFERWAY_API_KEY}"
      },
      "models": {
        "xiaomi/mimo-v2.6-flash": {
          "name": "Inferway",
          "limit": {
            "context": 393216,
            "output": 131072
          }
        }
      }
    }
  }
}

Run the basic check

Run from the terminal containing INFERWAY_API_KEY, inside the scratch folder. opencode run takes a positional message. Exit code 0 alone is not success — inspect the final text.

OpenCodebash
opencode run --pure --format json --title 'Inferway basic check' --model 'inferway/xiaomi/mimo-v2.6-flash' --agent build --dir . 'Reply with exactly: connected'

Confirm the connection

  1. Confirm the basic-check response text is exactly connected with no API error.
  2. Run the read check below. The prompt does not contain the nonce; confirm the final text is exactly the nonce from the fixture. This check covers the read loop only; Verification status lists everything tested for this model.
  3. Open Console → Requests to confirm the inference requests and token usage. Actual billing is the Console's, not any client estimate.
Read checkbash
opencode run --pure --format json --title 'Inferway read fixture' --model 'inferway/xiaomi/mimo-v2.6-flash' --agent build --dir . 'Read the file read-tool-fixture.txt and reply with exactly the nonce it contains, nothing else.'

Verification status

Verified on 1.18.25, macOS 26.6.2 arm64, 2026-09-25: basic conversation, and file-read, file-edit and shell-command tool round trips against inferway/mimo-v2.6-flash.

Streaming was not tested in one-shot mode by this receipt; the client may still stream, but this is not verified evidence here.

This evidence does not cover images, session resume, or reasoning control. Client-side cost estimates are not billing amounts; use Console → Requests and Usage for actual consumption.

Optional: use Inferway in your daily config

After the checks pass, copy the provider block (and the model entry under it) into your existing OpenCode config, keeping your own settings. You do not need the scratch folder or the test fixture for daily use.

Frequently asked questions

How do I configure Inferway in OpenCode? Add an @ai-sdk/openai-compatible provider entry in opencode.json. Use the composite selector inferway/<model_id> to invoke the model.

What capabilities are verified for OpenCode? In recorded verifications, file reading was demonstrated with read-tool-fixture.txt on verified models. Tool invocation beyond scoped reading or models without specific receipts remain marked unverified.

How do I switch back or remove the configuration? Remove the inferway provider block from your local opencode.json or select another configured provider from the CLI --model argument.

Why does OpenCode report that the model cannot be found? Ensure you distinguish between the catalog model ID (e.g. <model-id>) and the OpenCode provider selector (e.g. inferway/<model-id>), and check that the key exists under the provider's models mapping.

Cost and usage

Actual consumption is recorded by Inferway: open Console → Requests to see each request's status and token usage, and Console → Usage for totals. Numbers a client shows locally are its own estimates, not billing amounts; rely on the Console.

If a request fails

Authentication: check that an API key is present, active, and allowed to use the model. Reopen the client from the terminal containing the variable. Never print the full key when debugging.

Wrong endpoint or model: check for a duplicate /v1, use the exact published model ID, and confirm the client is using Chat Completions. A request to /responses or /completions cannot be repaired by changing the key.

Limits or timeout: check wallet balance and key limits, respect Retry-After, and reduce the prompt or output budget. Keep streaming enabled for long outputs. Avoid repeated agent retries while diagnosing.

When contacting support, share the client version, model ID, timestamp, and request ID if available. Redact credentials and source code.

File edit exercise: create the example directory

Draft and source review date: October 3, 2026. This exercise demonstrates reading and editing a file with xiaomi/mimo-v2.6-flash: changing status: pending to status: done-demo-1003 in edit-fixture.txt, preserving its title and newline. The cited acceptance took place on September 25, 2026; no inference was rerun for this guide.

You need OpenCode CLI, Git, and bash or zsh on macOS/Linux. Run opencode --version and record your version; consult official references if it differs. The September 25 record covers OpenCode CLI 1.18.25 on macOS 26.6.2 arm64 (basic conversation, file reading, file editing, and Shell tool round trips); it does not guarantee every version or platform.

Original MiMo credentials, endpoints, and model names belong to a separate service and are not interchangeable; do not copy original provider context settings as Inferway facts. This recipe uses a custom provider configuration and does not depend on a built-in provider listing.

Run this in a parent directory you choose for the exercise. If the directory exists, choose a fresh name first. Keep these files out of a real project and do not overwrite existing files. All five steps are chained with && so a failure halts immediately.

The last command stages the original fixture as a diff baseline; no commit is needed. This static fixture is a teaching example, not the original historical file (title: capability fixture, status: pending).

Fixture setupbash
mkdir inferway-opencode-edit-demo &&
cd inferway-opencode-edit-demo &&
git init -q &&
printf 'title: capability fixture\nstatus: pending\n' > edit-fixture.txt &&
git add -- edit-fixture.txt

File edit exercise: project config and permissions

Save opencode.json in the new directory. The provider block follows the Inferway guide reviewed on October 3, 2026. Permissions ask for read/edit approval and deny Shell both globally and for the selected build agent: agent-specific rules take precedence over global rules. These are teaching settings, not historical approval settings. Project configuration merges with other settings; check the selected agent's effective permissions. A fresh directory is not an operating-system sandbox.

The API model ID is xiaomi/mimo-v2.6-flash. OpenCode uses a provider/model selector, making it inferway/xiaomi/mimo-v2.6-flash here. @ai-sdk/openai-compatible supplies the Chat Completions integration. Include /v1 once and do not append /chat/completions to the base URL. Context and output limits reflect catalog maximum examples, not permanent promises or the expected output size of this task. Preserve your global settings; do not replace your daily configuration with this file.

opencode.jsonjson
{
  "$schema": "https://opencode.ai/config.json",
  "model": "inferway/xiaomi/mimo-v2.6-flash",
  "provider": {
    "inferway": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Inferway",
      "options": {
        "baseURL": "https://api.inferway.ai/v1",
        "apiKey": "{env:INFERWAY_API_KEY}"
      },
      "models": {
        "xiaomi/mimo-v2.6-flash": {
          "name": "Inferway",
          "limit": {
            "context": 393216,
            "output": 131072
          }
        }
      }
    }
  },
  "permission": {
    "read": "ask",
    "edit": "ask",
    "bash": "deny"
  },
  "agent": {
    "build": {
      "permission": {
        "read": "ask",
        "edit": "ask",
        "bash": "deny"
      }
    }
  }
}

File edit exercise: interactive file task

From the example directory, in the terminal that contains the key, start interactively:

  1. The official CLI reference documents the interactive interface, --model, and --agent; this example does not enable --auto. Confirm the selected model and build agent. If the interface shows auto approval, disable it through the command palette before entering the task. If read/edit approval is missing or Shell remains allowed, stop and review the effective permissions before continuing.
  2. Enter the prompt: 'Read edit-fixture.txt in the current directory. Use your file edit tool to replace the single line status: pending with status: done-demo-1003. Keep everything else, including the trailing newline. Modify only this file. Do not run Shell or change configuration. Afterward, tell me which line changed; do not merely paste the revised file in your reply.'
  3. Review the read and edit requests: their target must be edit-fixture.txt inside this exercise directory, and the edit must be only the status replacement. Approve those requests individually without granting broader future permissions. Reject and stop if the path, tool, or change exceeds this exercise. Tool events should correspond to reading and editing; historical records in OpenCode 1.18.25 noted read and edit events, which does not guarantee current run success.
OpenCodebash
opencode --model 'inferway/xiaomi/mimo-v2.6-flash' --agent build

File edit exercise: check the disk result

After ending the interactive session, run these checks yourself in the same directory; do not let the model confirm the result for you:

  1. The file should contain exactly two lines and a trailing newline: 'title: capability fixture' and 'status: done-demo-1003'.
  2. Teaching illustration of the expected diff (Git headers omitted; not a September 25 historical log): -status: pending / +status: done-demo-1003.
  3. Accept the result only when actual disk content matches your local diff: status alone changes, title remains, and no extra lines, newline changes, or unexpected edits appear. git status may show AM for the fixture because original is staged and working copy is edited; opencode.json is untracked. An unchanged file, empty diff, or reply containing only a code block means the file-edit check has not passed. A completion message or exit code 0 alone does not prove a disk write.
  4. Open Console → Requests to verify request status and token usage by time and model, and Console → Usage for totals. A file task can involve multiple model requests; console records determine actual charges, not client estimates.
Disk checkbash
cat edit-fixture.txt
git diff -- edit-fixture.txt
git status --short

What the historical verification establishes

The September 25 record used OpenCode CLI 1.18.25 on macOS 26.6.2 arm64 with Inferway MiMo: the basic reply was connected; the read check returned a random nonce absent from its prompt; the edit check read back the expected two lines on disk; the Shell check returned an unknown random marker printed by a script and checked its marker file. The public guide reports these four round trips as passed. This guide cites the public description and acceptance summary, without showing the original nonce, full transcript, or disk diff. It is not a new October 3 live test.

That receipt does not cover images, session resume, reasoning control, or streaming in one-shot mode. This interactive teaching workflow is not a new acceptance receipt either. Your own disk diff, tool events, and console requests are the evidence for your run.

Optional: daily config with permissions

To keep read/edit approval in daily use, merge the permission block into your global or project config rather than replacing it with the exercise file. If your version rejects permission settings, stop and consult its documentation, keeping approval enabled before continuing.

File edit exercise: troubleshooting

Authentication failure: check key validity and model permission; restart from the terminal containing the variable. Do not print the full key.

Model missing: distinguish the API model ID (xiaomi/mimo-v2.6-flash) from the OpenCode composite selector (inferway/xiaomi/mimo-v2.6-flash), and check the provider's model key. Confirm account-visible models in the console.

Endpoint or protocol error: check for duplicate /v1, remove /chat/completions from the base URL, and confirm the client is using Chat Completions (@ai-sdk/openai-compatible). A request sent to /responses or /completions cannot be repaired by changing the key.

Waiting for tool: look for an approval prompt in the interactive interface. Approve only specified file operations; do not diagnose by enabling automatic approval.

Completion reply, unchanged file: check the working directory, tool events, and actual diff. Pasted file contents in a model reply are not evidence of a disk write.

Budget, rate limit or timeout: check balance and key limits, honor Retry-After, and reduce the prompt or output budget. Stop repeated agent retries while diagnosing.

These endpoint, authentication, and usage branches follow the existing guide; approval and disk checks belong to this exercise. When contacting support, share the client version, model ID, timestamp, and request ID if available. Redact credentials and private source code.

Available Text Models & Pricing

All models below can be called directly in your client by specifying the model ID. Rates are the prices published for your market; data retention differs by model, see the Data Retention column.

Loading prices

Model NameModel IDContext WindowData RetentionInput PriceOutput PriceTypical Session Cost
DeepSeek V4.1 Flash 1017deepseek/deepseek-v4.1-flash-10171,048,576Third-party provider; its retention terms apply———
DeepSeek V4.1 Flash 1017 ZDRdeepseek/deepseek-v4.1-flash-1017-zdr1,000,000Provider states zero data retention———
DeepSeek V4.1 Flash Uncensoreddeepseek/deepseek-v4.1-uncensored1,048,576Third-party provider; its retention terms apply———
MiniMax M3.1 Flashminimax/minimax-m3.1-flash1,048,576Third-party provider; its retention terms apply———
Kimi K3.1 Promoonshotai/kimi-k3.1-pro1,048,576Third-party provider; its retention terms apply———
MiMo-V2.6 Flashxiaomi/mimo-v2.6-flash393,216Provider states zero data retention———
GLM-5.3z-ai/glm-5.31,000,000Third-party provider; its retention terms apply———
GLM-5.3 Flash Uncensoredz-ai/glm-5.3-flash-uncensored1,048,576Third-party provider; its retention terms apply———
GLM-5.3 Uncensoredz-ai/glm-5.3-uncensored1,048,576Third-party provider; its retention terms apply———

Typical Coding Session Cost Example

Note: This example assumes a typical multi-turn coding session with 50,000 input tokens and 2,000 output tokens (input covers codebase context and turn history; output covers generated code edits and replies). Token counts are illustrative constants; unit prices are the rates published for your market (in that market's currency), and the total cost is calculated dynamically at render time. Actual charges depend on verified usage recorded in the console.