Skip to content

Agentsflare Opencode Configuration Solution

Opencode Opencode is a very popular coding agent similar to Claude Code.

Install and Configure Opencode

Install Opencode

  1. Install using curl
bash
curl -fsSL https://opencode.ai/install | bash
  1. npm installation
bash
npm install -g opencode-ai
bash
bun install -g opencode-ai
bash
pnpm install -g opencode-ai
bash
yarn global add opencode-ai
  1. Mac installation
bash
brew install opencode-ai
  1. For other installation methods, see Opencode Installation Documentation

Configure Opencode

  1. Automatic configuration
bash
curl -fsSL https://agentsflare-public.obs.ap-southeast-3.myhuaweicloud.com/agentsflare-opencode-config-install.sh | bash
  1. Manual configuration Edit the content of ~/.config/opencode/opencode.json and add the following:
json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "agentsflare": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "agentsflare",
      "options": {
        "baseURL": "https://api.agentsflare.com/v1"
      },
      "models": {
        "claude-sonnet-4-5-20250929": {
          "name": "Claude Sonnet 4.5",
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-opus-4-5-20251101": {
          "name": "Claude Opus 4.5",
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-sonnet-4-20250514": {
          "name": "Claude Sonnet 4",
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-opus-4-20250514": {
          "name": "Claude Opus 4",
          "limit": {
            "context": 200000,
            "output": 32000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-3-7-sonnet-20250219": {
          "name": "Claude Sonnet 3.7",
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-opus-4-1-20250805": {
          "name": "Claude Opus 4.1",
          "limit": {
            "context": 200000,
            "output": 32000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-haiku-4-5-20251001": {
          "name": "Claude Haiku 4.5",
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        },
        "claude-3-haiku-20240307": {
          "name": "Claude Haiku 3",
          "limit": {
            "context": 200000,
            "output": 4096
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        }
      }
    },
    "agentsflare-codex": {
      "npm": "@ai-sdk/openai",
      "name": "agentsflare-codex",
      "options": {
        "baseURL": "https://api.agentsflare.com/v1"
      },
      "models": {
        "gpt-5-mini": {
          "name": "gpt-5-mini",
          "limit": {
            "context": 128000,
            "output": 128000
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          }
        }
      }
    }
  },
  "model": "agentsflare/claude-sonnet-4-5-20250929"
}

Configure Opencode Provider Key

  1. Run the command
bash
opencode auth login
  1. Tab switch search, enter Other. Opencode Other

  2. Enter custom provider ID: agentsflare Opencode Providers

  3. Copy and paste one of the API Keys from your Agentsflare console to complete authentication. Opencode api key

Use Agentsflare Provider

  1. Enter the opencode console
bash
opencode

Opencode Console

  1. Connect provider Enter /connect and press enter, then in the pop-up input box select agentsflare or enter agentsflare in the filter Opencode Connect Then enter the API Key again to complete connecting the provider. Opencode Connect

  2. Configuration complete, select the model you want to use to start using Opencode Console

This documentation is licensed under CC BY-SA 4.0.