Skip to main content

OpenCode

OpenCode is an AI coding agent for the terminal. This guide shows you how to set it up with KiosAPI.

Prerequisites

  • Node.js 18+ — check with node --version
  • A KiosAPI API key (starts with sk-) created in the group matching your models — Codex-Pro/Codex-Plus for gpt-5.x/gpt-6, Claude-Kiro for Claude, Gemini for Gemini (see Choosing a Token Group)

Installation

Install OpenCode globally:
Verify the installation:

Configuration

1. Set environment variables

Windows (PowerShell):
macOS / Linux: Add to ~/.bashrc or ~/.zshrc:
Reload your shell:

2. Config file

Create or edit ~/.config/opencode/config.json:
Replace sk-xxx with your actual KiosAPI key.

Usage

Interactive mode

Direct question

Specify a model

OpenCode supports any OpenAI-compatible model on KiosAPI. See the models list for available options.

Troubleshooting

Authentication Error

  • Verify OPENAI_API_KEY is set correctly: echo $OPENAI_API_KEY
  • Ensure the key starts with sk-
  • Check that apiBase in the config file matches the environment variable

Model Not Found

  • Check the model name is valid on the KiosAPI models page
  • Ensure the model is included in your token group

Verify Your Setup

Need Help?