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-swisscomgpt

v1.0.2

Published

SwisscomGPT provider for OpenCode - Access GPT-3.5, GPT-4, and GPT-5 via Swisscom's internal AI platform

Readme

opencode-swisscomgpt

SwisscomGPT provider for OpenCode - Access GPT-3.5, GPT-4, and GPT-5 via Swisscom's internal AI platform.

Features

  • 🚀 Access to GPT-5 and other models via Swisscom's GPU cluster
  • 🔐 JWT-based authentication via gpt.swisscom.com
  • 🔄 Full streaming support (SSE)
  • 🛠️ Easy integration with OpenCode

Installation

From npm (when published)

npm install opencode-swisscomgpt
# or
bun add opencode-swisscomgpt

From local source

# Clone and build
git clone https://github.com/mac-110/opencode-swisscomgpt.git
cd opencode-swisscomgpt
bun install
bun run build

# Install in OpenCode's config directory
cd ~/.config/opencode
bun add /path/to/opencode-swisscomgpt

Prerequisites

You need a Swisscom employee account to use this provider.

Getting your JWT Token

  1. Log in to gpt.swisscom.com
  2. Open Browser DevTools (F12)
  3. Go to the Network tab
  4. Reload the page or make any request
  5. Find a fetch request and look at the Headers tab
  6. Copy the token from the Authorization: Bearer <token> header

Configuration

1. Set Environment Variable

export SWISSCOMGPT_API_KEY="your-jwt-token"

# Or add to ~/.zshrc / ~/.bashrc for persistence
echo 'export SWISSCOMGPT_API_KEY="your-jwt-token"' >> ~/.zshrc

2. OpenCode Config

Add the provider to your ~/.config/opencode/opencode.json:

{
  "provider": {
    "swisscomgpt": {
      "npm": "opencode-swisscomgpt",
      "env": ["SWISSCOMGPT_API_KEY"],
      "options": {
        "baseURL": "https://api.rastro.icp.swisscom.com"
      },
      "models": {
        "gpt-5": {
          "name": "GPT-5",
          "id": "gpt-5",
          "attachment": true,
          "tool_call": true,
          "temperature": true,
          "cost": { "input": 0, "output": 0 },
          "limit": { "context": 128000, "output": 16384 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "gpt-5-instant": {
          "name": "GPT-5 Instant",
          "id": "gpt-5-instant",
          "attachment": true,
          "tool_call": true,
          "temperature": true,
          "cost": { "input": 0, "output": 0 },
          "limit": { "context": 128000, "output": 16384 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "gpt-5-thinking": {
          "name": "GPT-5 Thinking",
          "id": "gpt-5-thinking",
          "reasoning": true,
          "attachment": true,
          "tool_call": true,
          "temperature": true,
          "cost": { "input": 0, "output": 0 },
          "limit": { "context": 128000, "output": 32768 },
          "modalities": { "input": ["text"], "output": ["text"] }
        },
        "gpt-4-turbo": {
          "name": "GPT-4 Turbo",
          "id": "gpt-4-turbo",
          "attachment": true,
          "tool_call": true,
          "temperature": true,
          "cost": { "input": 0, "output": 0 },
          "limit": { "context": 128000, "output": 4096 },
          "modalities": { "input": ["text"], "output": ["text"] }
        }
      }
    }
  },
  "model": "swisscomgpt/gpt-5",
  "small_model": "swisscomgpt/gpt-4-turbo"
}

Important: OpenCode requires explicit model definitions in the models object. Each model you want to use must be defined with its capabilities and limits.

Model Configuration Reference

| Field | Type | Description | |-------|------|-------------| | name | string | Display name in OpenCode | | id | string | API model identifier | | tool_call | boolean | Supports function calling | | reasoning | boolean | Model has reasoning/thinking capability | | attachment | boolean | Supports file attachments | | temperature | boolean | Supports temperature parameter | | cost.input | number | Cost per 1M input tokens (USD) | | cost.output | number | Cost per 1M output tokens (USD) | | limit.context | number | Max context window size | | limit.output | number | Max output tokens | | modalities.input | array | Supported input types: text, image, audio | | modalities.output | array | Supported output types: text, image, audio |

Available Models

GPT-5 Models

| Model ID | Description | |----------|-------------| | gpt-5 | Default GPT-5 model | | gpt-5-instant | ⚡ Fastest replies, no deep thought | | gpt-5-thinking-mini | 💡 Light, efficient reasoning | | gpt-5-thinking | 🧠 Slower, more detailed reasoning |

GPT-4 Models (Legacy)

| Model ID | Description | |----------|-------------| | gpt-4o | Great for general tasks | | gpt-4o-mini | Faster for simple tasks | | gpt-4-turbo | High performance | | gpt-4.1 | Optimized for coding |

Reasoning Models

| Model ID | Description | |----------|-------------| | o3 | Advanced reasoning model | | o3-mini | Fast reasoning model |

Claude

| Model ID | Description | |----------|-------------| | claude-3.5-sonnet | Great for creative writing and code |

Swiss Models 🇨🇭

| Model ID | Description | |----------|-------------| | apertus | Swiss-trained open model | | llama-4-scout | Large context model |

Usage with OpenCode

# Verify models are available
opencode models swisscomgpt

# Start OpenCode (uses configured default model)
opencode

# Switch model in session
/model swisscomgpt/gpt-5-thinking

Programmatic Usage

You can also use this provider directly in your code:

import { createSwisscomGPT } from 'opencode-swisscomgpt';
import { generateText } from 'ai';

const swisscomgpt = createSwisscomGPT({
  apiKey: process.env.SWISSCOMGPT_API_KEY!,
});

const { text } = await generateText({
  model: swisscomgpt('gpt-5'),
  prompt: 'Explain quantum computing in simple terms.',
});

console.log(text);

With Streaming

import { createSwisscomGPT } from 'opencode-swisscomgpt';
import { streamText } from 'ai';

const swisscomgpt = createSwisscomGPT({
  apiKey: process.env.SWISSCOMGPT_API_KEY!,
});

const result = await streamText({
  model: swisscomgpt('gpt-5'),
  prompt: 'Write a short story about AI.',
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

API Reference

createSwisscomGPT(config)

Creates a SwisscomGPT provider instance compatible with Vercel AI SDK.

Config Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | required | JWT Bearer token from gpt.swisscom.com | | baseURL | string | https://api.rastro.icp.swisscom.com | API base URL | | threadId | string | auto-generated | UUID for conversation continuity | | policy | string | SKIP | API policy parameter |

How It Works

This provider wraps @ai-sdk/openai-compatible and transforms requests for SwisscomGPT's API:

  1. URL Transformation: /v1/chat/completions/v2/chat/completions/{threadId}?policy=SKIP
  2. Authentication: Uses JWT Bearer token in Authorization header
  3. Thread ID: Auto-generates UUID per request for conversation tracking

Troubleshooting

"Provider not found: swisscomgpt"

  1. Make sure the package is installed in ~/.config/opencode/node_modules/
  2. Verify your opencode.json has explicit model definitions
  3. Check that the package is built (dist/ folder exists)

Token Expired

JWT tokens from gpt.swisscom.com expire after ~24h. Get a fresh token from the browser.

Network Errors

Make sure you're connected to the Swisscom network (VPN if remote).

Security Notes

  • Never commit your JWT token to version control
  • Use environment variables for the API key
  • Tokens are tied to your personal Swisscom account

Contributing

Contributions welcome! Please read our Contributing Guide.

License

MIT © Swisscom / Alexander Schäfer


Made with ❤️ for Swisscom developers