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

@kenkaiiii/gg-ai

v4.2.6

Published

Unified LLM streaming API for Anthropic and OpenAI

Readme

@kenkaiiii/gg-ai

One function. Flat options. Switch providers by changing a string. No adapters, no plugins, no wrapper classes.

Part of the GG Framework monorepo.


Install

npm i @kenkaiiii/gg-ai

How it works

Call stream() with a provider, model, and messages. That's the entire API.

  • for await gives you streaming events (text_delta, thinking_delta, toolcall_done, etc.)
  • await gives you the final response (message, stopReason, usage)

Same function, same call. Dual-nature StreamResult — async iterable and thenable.

Tool parameters are Zod schemas. Converted to JSON Schema at the provider boundary automatically.


Providers

| Provider | Models | Notes | |---|---|---| | anthropic | Claude Opus 4.6, Sonnet 4.6, Haiku 4.5 | Extended thinking, prompt caching, server-side compaction | | openai | GPT-4.1, o3, o4-mini | Supports OAuth (codex endpoint) and API keys | | glm | GLM-5, GLM-4.7 | Z.AI platform, OpenAI-compatible | | moonshot | Kimi K2.5 | Moonshot platform, OpenAI-compatible |


Stream events

| Event | Description | |---|---| | text_delta | Incremental text output | | thinking_delta | Extended thinking output (Anthropic) | | toolcall_delta | Streaming tool call arguments | | toolcall_done | Completed tool call with parsed args | | server_toolcall | Server-side tool invocation | | server_toolresult | Server-side tool result | | done | Stream finished, includes stop reason | | error | Error occurred |


Options

| Option | Type | Description | |---|---|---| | provider | "anthropic" \| "openai" \| "glm" \| "moonshot" | Required | | model | string | Required | | messages | Message[] | Required | | tools | Tool[] | Tool definitions with Zod schemas | | toolChoice | "auto" \| "none" \| "required" \| { name } | Tool selection strategy | | serverTools | ServerToolDefinition[] | Server-side tool definitions | | maxTokens | number | Max output tokens | | temperature | number | Sampling temperature | | topP | number | Nucleus sampling | | stop | string[] | Stop sequences | | thinking | "low" \| "medium" \| "high" \| "max" | Extended thinking (Anthropic) | | apiKey | string | Provider API key | | baseUrl | string | Custom endpoint | | signal | AbortSignal | Cancellation | | cacheRetention | "none" \| "short" \| "long" | Prompt cache preference | | compaction | boolean | Server-side compaction (Anthropic only) |


License

MIT