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

@warmblood/monocle-cli

v0.5.4

Published

CLI authentication tool for Claude Code with Stark OIDC PKCE integration

Downloads

740

Readme

Monocle CLI

한국어

Terminal utility to control and use Monocle AI. Log in once, then chat with models, integrate Claude Code, or call Monocle's OpenAI-compatible API from your own apps — all with the same authenticated session.

Prerequisites

  • Node.js 18+ — check with node -v

🚀 Setup

npm install -g @warmblood/monocle-cli
monocle login

A browser opens — sign in with your organization account.

✅ Check status

monocle status

Shows your tenant, user, access/refresh token validity, and whether Claude Code is globally configured to route through Monocle. Read-only — it does not refresh tokens.

📖 Commands

| Command | Description | |---------|-------------| | monocle login [--tenant <domain>] [--device-code] | Sign in | | monocle status | Show login, token, and Claude Code configuration status | | monocle token | Print current access token (auto-refreshed when near expiry) | | monocle model list | List available models | | monocle model chat [--model <id>] [--system-prompt <text>] [--system-prompt-file <path>] [--max-tokens <n>] | Chat with a model (REPL or stdin) | | monocle claude [...args] | Launch Claude Code through Monocle (args pass through) | | monocle setup | Globally route plain claude through Monocle (opt-in) | | monocle unset | Remove the global claude routing |

💬 Chat with models

List what your tenant has:

$ monocle model list
MODEL ID              NAME                  OWNER       CONTEXT
────────────────────  ────────────────────  ──────────  ─────────
claude-sonnet-4-6     Claude Sonnet 4.6     anthropic   200k
claude-opus-4-7       Claude Opus 4.7       anthropic   200k
gpt-4o                GPT-4o                openai      128k

3 model(s) available.

Interactive REPL:

$ monocle model chat --model claude-sonnet-4-6
Monocle Chat (model: claude-sonnet-4-6)
Router: https://api.monocle-ai.com
Type your message. Press Ctrl+D to exit.
---
> Hello
Hello! How can I help you today?

> /quit
Bye.

One-shot via stdin:

$ echo "Summarize OAuth 2.0 in one sentence." | monocle model chat
Using model: claude-sonnet-4-6
Router: https://api.monocle-ai.com
OAuth 2.0 is an authorization framework that lets applications access a user's resources on another service without sharing the user's password.

With a system prompt from a file:

monocle model chat --system-prompt-file ./persona.md --model claude-opus-4-7

🤖 Claude Code integration

monocle claude

Other terminals and IDE integrations running plain claude are unaffected. To globally route plain claude through Monocle, run monocle setup once; undo with monocle unset.

[!NOTE] See Claude Code integration details for ANTHROPIC_API_KEY handling, global setup, and troubleshooting.

🔌 Using Monocle from your own app (OpenAI-compatible SDK)

Monocle exposes an OpenAI-compatible Chat Completions API, so any OpenAI client works with two env vars. Export them once:

export MONOCLE_API_KEY="$(monocle token)"
export MONOCLE_BASE_URL="$(jq -r .router_url ~/.monocle/credentials.json)/v1"

Then from Python:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MONOCLE_API_KEY"],
    base_url=os.environ["MONOCLE_BASE_URL"],
)

resp = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

[!NOTE] See Using Monocle with the OpenAI SDK for Node.js, curl, streaming, token-refresh patterns for long-running apps, and troubleshooting.

🆘 Troubleshooting

"Not logged in" error → Run monocle login first.

Token expiredmonocle token auto-refreshes when near expiry. If it's been more than 30 days since your last login, run monocle login again.

For Claude Code and OpenAI SDK specific issues, see the linked guides above.

Help

Contact your organization admin or open an issue in this repository.