跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    NotYusta

    Amanai Provider

    opencode-amanai-provider·v1.2.0·模型接入

    Amanai provider plugin for OpenCode (OpenAI-compatible API at https://api.amanai.dev/v1)

    GitHub 星标

    0

    月装机量

    751

    近 7 天 751

    综合评分

    37.7

    生态多维模型

    最近提交

    1 天前

    2026-10-03

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-amanai-provider@1.2.0"]
    }

    OpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    npm version license

    An OpenCode plugin that registers the Amanai provider — an OpenAI-compatible API at https://api.amanai.dev/v1 — and discovers the models it serves (currently ~47: GLM, Qwen, Kimi, DeepSeek, MiniMax, Grok, GPT, Claude, and more).

    Install

    Publish the package once (see Publishing), then install it on any machine:

    # From npm
    opencode plugin add opencode-amanai-provider
    
    # Or straight from a Git repository
    opencode plugin add github:YOUR_GITHUB_USER/opencode-amanai-provider
    

    Restart or reload OpenCode, then select a model with /models, for example amanai/glm-5.3.

    For a local checkout instead of a published package, add the directory to plugins in your global opencode.jsonc:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugins": ["/absolute/path/to/opencode-amanai-provider"]
    }
    

    Authentication

    The plugin reads your API key from the AMANAI_API_KEY environment variable:

    # PowerShell
    $env:AMANAI_API_KEY = "your-key"
    opencode service restart
    
    # bash / zsh
    export AMANAI_API_KEY="your-key"
    opencode service restart
    

    You can also run /connect, choose Amanai, and paste the key. The plugin registers both an environment method and an interactive key method.

    Configuration

    Setting Default Purpose
    AMANAI_API_KEY – API key.
    AMANAI_BASE_URL https://api.amanai.dev/v1 Override the endpoint.

    How it works

    On setup the plugin fetches GET /models and registers every returned model with its context window, output limit, and input modalities. A baked-in inventory is used when discovery is unavailable, and the inventory is refreshed every six hours.

    Amanai advertises the reasoning levels it accepts in each model's thinking list. The plugin exposes every level except the default (auto) as a model variant backed by settings.reasoningEffort, so you can pick one with the #variant selector:

    opencode run --model amanai/glm-5.3#high "Review this migration plan"
    

    Run /models to see the available efforts for a model. Levels differ per model (low/medium/high/xhigh/max, and none/minimal where supported).

    Transient failures are retried instead of ending the turn. A request that hits a rate limit, a server error, or loses its connection mid-stream is retried up to five times with exponential backoff and jitter, mirroring the Command Code provider. Client errors such as a bad request or a rejected credential stay terminal.

    Publishing

    npm login
    npm publish --access public
    

    The package name opencode-amanai-provider is free on the public registry; use a scope such as @yourname/opencode-amanai-provider if you prefer.

    同类生态推荐