npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhafron/opencode-iflow-auth

v1.0.1

Published

OpenCode plugin for iFlow providing access to Claude, GPT, Gemini, DeepSeek, and Qwen models

Readme

OpenCode iFlow Auth Plugin

npm version npm downloads license

OpenCode plugin for iFlow.cn providing access to Qwen, DeepSeek, Kimi, GLM, and iFlow ROME models with dual authentication support.

Features

  • Dual authentication: OAuth 2.0 (PKCE) and API Key support.
  • Multi-account rotation with sticky and round-robin strategies.
  • Automated token refresh and rate limit handling with exponential backoff.
  • Native thinking mode support for GLM-4.x models.
  • Configurable request timeout and iteration limits to prevent hangs.
  • Automatic port selection for OAuth callback server to avoid conflicts.

Installation

Add the plugin to your opencode.json or opencode.jsonc:

{
  "plugin": ["@zhafron/opencode-iflow-auth"],
  "provider": {
    "iflow": {
      "models": {
        "iflow-rome-30ba3b": {
          "name": "iFlow ROME 30B",
          "limit": { "context": 256000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "qwen3-coder-plus": {
          "name": "Qwen3 Coder Plus",
          "limit": { "context": 1000000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "qwen3-max": {
          "name": "Qwen3 Max",
          "limit": { "context": 256000, "output": 32000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "qwen3-vl-plus": {
          "name": "Qwen3 VL Plus",
          "limit": { "context": 256000, "output": 32000 },
          "modalities": { "input": ["text", "image"], "output": ["text"] }
        },
        "qwen3-235b-a22b-thinking-2507": {
          "name": "Qwen3 235B Thinking",
          "limit": { "context": 256000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "kimi-k2": {
          "name": "Kimi K2",
          "limit": { "context": 128000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "kimi-k2-0905": {
          "name": "Kimi K2 0905",
          "limit": { "context": 256000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "glm-4.6": {
          "name": "GLM-4.6 Thinking",
          "limit": { "context": 200000, "output": 128000 },
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "variants": {
            "low": { "thinkingConfig": { "thinkingBudget": 1024 } },
            "medium": { "thinkingConfig": { "thinkingBudget": 8192 } },
            "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
          }
        },
        "deepseek-v3": {
          "name": "DeepSeek V3",
          "limit": { "context": 128000, "output": 32000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "deepseek-v3.2": {
          "name": "DeepSeek V3.2",
          "limit": { "context": 128000, "output": 64000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "deepseek-r1": {
          "name": "DeepSeek R1",
          "limit": { "context": 128000, "output": 32000 },
          "modalities": { "input": ["text"], "output": ["text"] },
          "variants": {
            "low": { "thinkingConfig": { "thinkingBudget": 1024 } },
            "medium": { "thinkingConfig": { "thinkingBudget": 8192 } },
            "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
          }
        },
        "qwen3-32b": {
          "name": "Qwen3 32B",
          "limit": { "context": 128000, "output": 32000 },
          "modalities": { "input": ["text"], "output": ["text"] }
        }
      }
    }
  }
}

Setup

  1. Run opencode auth login.
  2. Select Other, type iflow, and press enter.
  3. Choose authentication method:
    • OAuth 2.0: Follow browser flow for secure token-based authentication.
    • API Key: Enter your iFlow API key (starts with sk-).
  4. Configuration template will be automatically created at ~/.config/opencode/iflow.json on first load.

Configuration

The plugin supports extensive configuration options. Edit ~/.config/opencode/iflow.json:

{
  "default_auth_method": "oauth",
  "account_selection_strategy": "round-robin",
  "auth_server_port_start": 8087,
  "auth_server_port_range": 10,
  "max_request_iterations": 50,
  "request_timeout_ms": 300000,
  "enable_log_api_request": false
}

Configuration Options

  • default_auth_method: Default authentication method (oauth, apikey)
  • account_selection_strategy: Account rotation strategy (sticky, round-robin)
  • auth_server_port_start: Starting port for OAuth callback server (1024-65535)
  • auth_server_port_range: Number of ports to try (1-100)
  • max_request_iterations: Maximum loop iterations to prevent hangs (10-1000)
  • request_timeout_ms: Request timeout in milliseconds (60000-600000ms)
  • enable_log_api_request: Enable API request/response logging (errors always logged)

Environment Variables

All configuration options can be overridden via environment variables:

  • IFLOW_DEFAULT_AUTH_METHOD
  • IFLOW_ACCOUNT_SELECTION_STRATEGY
  • IFLOW_AUTH_SERVER_PORT_START
  • IFLOW_AUTH_SERVER_PORT_RANGE
  • IFLOW_MAX_REQUEST_ITERATIONS
  • IFLOW_REQUEST_TIMEOUT_MS
  • IFLOW_ENABLE_LOG_API_REQUEST

Storage

Linux/macOS:

  • Credentials: ~/.config/opencode/iflow-accounts.json
  • Plugin Config: ~/.config/opencode/iflow.json

Windows:

  • Credentials: %APPDATA%\opencode\iflow-accounts.json
  • Plugin Config: %APPDATA%\opencode\iflow.json

Thinking Models

iFlow supports thinking models with customizable thinking budgets via variants:

GLM-4.6

Automatically enables thinking mode with configurable budget:

{
  "variants": {
    "low": { "thinkingConfig": { "thinkingBudget": 1024 } },
    "medium": { "thinkingConfig": { "thinkingBudget": 8192 } },
    "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
  }
}

The plugin automatically transforms requests to:

{
  "chat_template_kwargs": {
    "enable_thinking": true,
    "clear_thinking": false
  },
  "thinking_budget": 8192  // from variant config
}

DeepSeek R1

Supports thinking budget control via variants:

{
  "variants": {
    "low": { "thinkingConfig": { "thinkingBudget": 1024 } },
    "medium": { "thinkingConfig": { "thinkingBudget": 8192 } },
    "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
  }
}

The plugin automatically adds thinking_budget parameter to requests.

Response Format

Both models return reasoning content in the response:

{
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "The answer is 4.",
      "reasoning_content": "Let me think step by step..."
    }
  }],
  "usage": {
    "completion_tokens_details": {
      "reasoning_tokens": 1094
    }
  }
}

Disclaimer

This plugin is provided strictly for learning and educational purposes. It is an independent implementation and is not affiliated with, endorsed by, or supported by iFlow.cn. Use of this plugin is at your own risk.

Feel free to open a PR to optimize this plugin further.