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

@sixb/model-protocols

v0.1.1

Published

Internal model protocol implementations for Sixb providers

Readme

@sixb/model-protocols

Shared request serialization and streaming decoders for Sixb model providers.

Internal package. Applications should use a provider such as @sixb/anthropic, @sixb/vercel-ai-gateway, or @sixb/azure-ai-foundry. Provider packages depend on this package with workspace:* (published as an exact version). No independent compatibility promise.

Protocols at a glance

| Import subpath | API format | Official documentation | | --- | --- | --- | | /responses | OpenAI Responses | Reference · Streaming | | /messages | Anthropic Messages | Reference · Streaming | | /chat | OpenAI-compatible Chat Completions | Streaming reference |

Sixb ModelMessage[] → input serializer → native request fields
HTTP response body → SSE decoder      → AsyncIterable<LanguageModelStreamEvent>

| This package owns | The provider owns | | --- | --- | | Message/file/tool serialization | HTTP, endpoints, authentication, retries | | Stream parsing and fragment assembly | Model capabilities, schemas, request options | | Provider-namespaced replay data | Replay-scope validation, catalogs, caching, pricing | | Raw usage collection and normalization hooks | Provider-specific accounting assumptions |

Only the three subpaths are exported; there is no root API. All use a shared, bounded SSE decoder that handles fragmented UTF-8 and closes unfinished streams on abort or consumer return.

Responses

import {
  responsesInput,
  responsesEvents,
  responsesUsage,
  type ResponsesStreamOptions,
} from "@sixb/model-protocols/responses"

| Function | Purpose | | --- | --- | | responsesInput(messages, providerId) | Serialize messages, files, tools, phases, and encrypted reasoning replay. | | responsesEvents(body, signal, options) | Assemble text/reasoning/tool events and validate terminal completion. | | responsesUsage(raw) | Preserve reported counters and raw usage; missing counters stay unknown. |

  • Completion: requires a terminal response event, such as response.completed.
  • Interrupted responses: retain their truncation/filter reason even after tool arguments close; Sixb's model loop rejects local tool execution on unsuccessful finishes while retaining usage.
  • Replay: retains ordered native items under the calling provider's ID.
  • Hooks: ResponsesStreamOptions supports usage normalization, provider IDs, and finish metadata (provider data, reported cost, route). Event parsing stays in the decoder.

Messages

import {
  messagesInput,
  messagesEvents,
  type MessagesStreamOptions,
} from "@sixb/model-protocols/messages"

| Function | Purpose | | --- | --- | | messagesInput(messages, providerId, errorPrefix) | Return system/content blocks; serialize images/PDFs and tools; merge adjacent roles. | | messagesEvents(body, signal, options) | Assemble text, tools, thinking/signatures, citations, and opaque native blocks. |

message_start
  content_block_start → content_block_delta* → content_block_stop  (repeated per block)
  message_delta*       (stop reason and cumulative usage)
message_stop
  • Replay: preserves signed/redacted thinking and native blocks; foreign thinking is not synthesized.
  • Usage: recursively merges cumulative snapshots, ignoring null updates. Raw meters are retained.
  • Hook: MessagesStreamOptions.usage replaces the default Anthropic normalizer.

| Default Anthropic accounting | Behavior | | --- | --- | | Input total | Uncached input_tokens + cache reads + cache writes. | | Missing cache counters | Default to zero when uncached input is reported. | | Cache TTL splits | Remain unknown for nonzero aggregate writes without a breakdown. | | Text output | Total output minus thinking tokens; missing thinking is treated as zero. |

Foundry overrides these defaults to keep absent cache/thinking counters unknown. See prompt caching for meter definitions and tool streaming for partial JSON assembly.

Chat Completions

import {
  chatInput,
  chatEvents,
  type ChatInputOptions,
  type ChatStreamOptions,
} from "@sixb/model-protocols/chat"

| Function | Purpose | | --- | --- | | chatInput(messages, options) | Serialize system/developer messages, images, function calls, and tool results. | | chatEvents(body, signal, options) | Decode one choice, text/reasoning, fragmented tools, refusals, usage, and Azure filters. |

choice deltas → choice finish → final usage / delayed filter annotations → [DONE]
  • Completion: waits for [DONE]; a choice finish alone is insufficient. Malformed or incomplete streams fail. Truncated/filtered tool calls are not emitted as executable calls.
  • Usage: passes the last non-null snapshot to the required ChatStreamOptions.usage callback.
  • Replay: omitted by default. Optional tool-continuation replays only this provider's reasoning on tool-call messages after the latest user message. Providers validate replay scope first.
  • Limits: single choice; bounded replay/tool and annotation buffers. Opaque state and provider-executed tools are unsupported. Literal <think> tags remain ordinary text.

Hosting-specific behavior

Matching an API format does not establish feature or billing parity. For Azure, also consult: