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

opencode-bedrock-openai-token

v0.1.4

Published

OpenCode plugin for AWS Bedrock token authentication via the OpenAI-compatible endpoint

Downloads

664

Readme

opencode-bedrock-openai-token

OpenCode plugin that authenticates requests to AWS Bedrock's OpenAI-compatible endpoint using short-lived tokens from the Bedrock Token Generator.

Install

Add the plugin to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-bedrock-openai-token"]
}

Configure the provider

Define a bedrock-openai provider in your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-bedrock-openai-token"],
  "provider": {
    "bedrock-openai": {
      "npm": "@ai-sdk/openai",
      "name": "OpenAI on Bedrock",
      "options": {
        "baseURL": "https://bedrock-mantle.us-east-1.api.aws/openai/v1",
        "region": "us-east-1",
        "profile": "my-profile"
      },
      "models": {
        "openai.gpt-5.5": { "name": "GPT-5.5 (Bedrock)" }
      }
    }
  }
}

The plugin automatically seeds authentication on startup — no manual auth.json editing required.

Provider options

| Option | Description | Default | | ------------ | ------------------------------------ | --------------------------------- | | baseURL | Bedrock OpenAI-compatible endpoint | (required) | | region | AWS region for token generation | $AWS_REGION or us-east-1 | | profile | AWS credentials profile | $AWS_PROFILE or default chain |

Authentication

The plugin uses the AWS Node Provider Chain to resolve credentials. It supports:

  • Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  • Shared credentials file (~/.aws/credentials)
  • SSO profiles
  • IAM roles (EC2, ECS, Lambda)

If profile is set in the provider options (or AWS_PROFILE is set in the environment), that named profile is used.

Tokens are cached for 11 hours and refreshed automatically.

How it works

  1. On plugin load, client.auth.set seeds a placeholder entry in auth.json so the provider is recognized.
  2. The config hook reads region and profile from your provider config.
  3. The auth.loader hook provides an initial apiKey (bearer token) to the provider.
  4. The chat.headers hook injects a fresh Authorization: Bearer <token> header on every request to the bedrock-openai provider.

Local development

To use as a local plugin instead of installing from npm, copy src/index.ts to your plugins directory:

~/.config/opencode/plugins/bedrock-token.ts

And add the dependencies to ~/.config/opencode/package.json:

{
  "dependencies": {
    "@aws-sdk/credential-providers": "^3.0.0",
    "@aws/bedrock-token-generator": "^1.1.0"
  }
}

License

MIT