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

@telnyx/opencode

v0.1.2

Published

Telnyx auth and provider plugin for OpenCode

Readme

@telnyx/opencode

@telnyx/opencode adds Telnyx as an OpenCode provider, integrates with opencode auth login, auto-registers supported Telnyx-hosted models, exposes a /telnyx model manager in the TUI, and works around Telnyx's max_completion_tokens + tools incompatibility.

Install

opencode plugin install @telnyx/opencode

This auto-detects both the server and TUI targets and adds the plugin to opencode.json (server) and tui.json (TUI) automatically.

For global install (all projects):

opencode plugin install -g @telnyx/opencode

What it does

  • registers a telnyx provider via @ai-sdk/openai-compatible
  • adds telnyx to opencode auth login
  • reads the Telnyx API key from either TELNYX_API_KEY or OpenCode's stored auth.json credential
  • fetches available models from https://api.telnyx.com/v2/ai/models at startup
  • registers only Telnyx-hosted text models from the API response
  • enables these three recommended models by default:
    • moonshotai/Kimi-K2.6
    • zai-org/GLM-5.1-FP8
    • MiniMaxAI/MiniMax-M2.7
  • persists the enabled-model allowlist in ~/.config/opencode/telnyx-models.json
  • lets users enable additional Telnyx-hosted models through the /telnyx TUI command
  • strips maxOutputTokens before requests so Telnyx accepts tool-enabled runs

Authenticate

Log in with your Telnyx API key:

opencode auth login --provider telnyx --method "API Key"

During login the plugin also asks which Telnyx model preset to enable:

  • Recommended 3 (default)
  • All hosted Telnyx models
  • Keep existing config

You can also supply the key directly with an environment variable:

export TELNYX_API_KEY="YOUR_KEY"

Verify the credential is present:

opencode auth list

Run a model

opencode run --model 'telnyx/moonshotai/Kimi-K2.6' 'Say hello in one sentence.'

How auth works

Auth precedence is:

  1. TELNYX_API_KEY
  2. Stored telnyx API credential in ~/.local/share/opencode/auth.json

opencode auth login stores the key in OpenCode's normal auth store, so this behaves like a native provider instead of relying on hardcoded config.

Model registration

At startup the plugin calls GET https://api.telnyx.com/v2/ai/models and registers only Telnyx-hosted text-generation models whose IDs are present in the persisted allowlist file.

Default allowlist:

  • moonshotai/Kimi-K2.6
  • zai-org/GLM-5.1-FP8
  • MiniMaxAI/MiniMax-M2.7

Allowlist file:

{
  "version": 1,
  "enabledModels": [
    "moonshotai/Kimi-K2.6",
    "zai-org/GLM-5.1-FP8",
    "MiniMaxAI/MiniMax-M2.7"
  ]
}

Path:

  • ~/.config/opencode/telnyx-models.json
  • override with OPENCODE_TELNYX_MODELS_PATH

TUI model manager

The package also registers a /telnyx command (alias: /telnyx-models) that opens an interactive model manager in the OpenCode TUI.

  • the dialog starts from the default 3-model allowlist
  • selecting a model toggles it on or off
  • changes are persisted to ~/.config/opencode/telnyx-models.json
  • updated provider model availability is applied without manually editing config files

This command manages which Telnyx-hosted models are available under the telnyx provider. It does not change OpenCode core model-selection behavior outside this plugin.

This plugin does not currently create or manage Telnyx api_key_ref integration secrets for external providers such as Groq, OpenAI, Anthropic, Google, or xAI.

Why the plugin exists

Telnyx rejects requests that include both function tools and max_completion_tokens / max_tokens. OpenCode normally sends tools and an output token cap together. This plugin fixes that by unsetting maxOutputTokens for the telnyx provider before the SDK builds the request.

Develop locally

npm install
npm run typecheck
npm run build

Live regression harness

The repo includes a live regression harness that:

  • fetches the current Telnyx model list from https://api.telnyx.com/v2/ai/models
  • applies the same text-model + Telnyx-hosted filtering as the plugin
  • runs a simple prompt against every model
  • runs a tool-calling prompt against every model using OpenCode's read tool
  • reports excluded external-key models separately so you can see which Telnyx-listed models are passthrough-only

Create a .env file in plugins/opencode/ or export TELNYX_API_KEY, then run:

npm test

Useful optional filters:

TELNYX_TEST_MODEL_MATCH=Llama-3.3-70B-Instruct npm test
TELNYX_TEST_LIMIT=1 npm test
TELNYX_TEST_AGENT=sisyphus npm test
TELNYX_TEST_VARIANT=max npm test
TELNYX_TEST_INCLUDE_EXTERNAL=1 npm test

Artifacts are written to test/.artifacts/, including raw per-model outputs and a results.json summary. External-provider models are reported separately and, if included explicitly, marked as skipped because the plugin intentionally does not register them without provider-specific key support.

Troubleshooting

Unknown provider "telnyx"

The package is not loaded. Check that @telnyx/opencode is listed in opencode.json, then restart OpenCode.

No Telnyx models show up

The API key is missing or invalid. Run:

opencode auth list

or set TELNYX_API_KEY and retry.

A small-context model fails while larger models work

Some smaller models cannot fit OpenCode's full tool list and system prompt into their effective prompt budget. This is model-specific, not a plugin auth issue.

/telnyx does not appear

The TUI plugin requires a tui.json entry. Run opencode plugin install @telnyx/opencode which configures both opencode.json and tui.json automatically. If you added the plugin manually to opencode.json, you also need tui.json:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["@telnyx/opencode"]
}

Then restart OpenCode.