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

@civaapple/qi-ai

v0.7.3

Published

Portable Qi model protocol, provider adapters, and context compiler

Downloads

572

Readme

@civaapple/qi-ai

Portable model integration and deterministic context compilation for Qi.

The root exports ModelPort, portable request/event schemas, scripted test ports, provider profiles, and OpenAI-compatible Chat Completions/Responses adapters. ./context exports the budget-aware Context Compiler.

npm install @civaapple/qi-ai

Provider-specific response IDs, transport state, and credentials never enter durable Session truth. A provider adapter streams portable text/reasoning/action boundaries; Agent lifecycle policy remains in @civaapple/qi-agent. Profiles may declare model-specific windows and thinking modes when one provider exposes materially different models; callers can inspect them with getProviderModelProfile and providerModelContextTokens.

Built-in profiles live as declarative JSON under src/catalog/. Wire thinking dialects (ProviderWireHints) drive Chat Completions / Responses field shapes; composition roots may overlay $QI_HOME/providers/*.{toml,json} via parseProviderCatalogDocument / installProviderCatalogOverBuiltins (CLI Settings can write these files for custom OpenAI-compatible vendors). User config.toml provider must reference an installed catalog id after overlays load. Profiles also declare input modalities and optional per-model wire-API overrides. Kimi K3 and the known Kimi Coding models accept image parts; K3 uses a 1,048,576-token window and effort thinking (low/high/max, default high) sent as top-level reasoning_effort. K2.7 Code keeps thinking always on with thinking.keep=all. Callers may discover remote models with listOpenAICompatibleModels and merge them via mergeProviderModels without changing catalog thinking authority. DeepSeek V4 Flash uses Responses with a 1M window and effort thinking; V4 Pro stays on Chat Completions until the vendor adds Responses. Volcengine Agent Plan (volcengine-agent-plan) uses Responses at the Agent Plan base URL with ARK_API_KEY, default glm-latest, and deep-thinking control via thinking.type plus reasoning.effort (low/medium/high). Qianwen AI Token Plan (qianwenai) uses https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 with QIANWENAI_API_KEY, default qwen3.8-max-preview on Responses, and Chat Completions for glm-5-2 / deepseek-v4-pro. Thinking uses reasoning.effort (Responses) or enable_thinking + reasoning_effort (Chat Completions). OpenAI Responses accepts images; DeepSeek rejects them. Custom OpenAI-compatible Chat Completions endpoints deny image input unless imageInput is explicitly enabled by the operator. Portable assistant messages may carry a reasoning part so thinking-mode tool turns can round-trip CoT. Chat Completions sends portable user text/images as a standard content array; image-bearing Tool results keep their Tool call/output message and add a following synthetic user media message. Artifact references must be verified and materialized before either adapter is invoked.

import { createModelPortForProfile, listOpenAICompatibleModels } from "@civaapple/qi-ai";
import { compileContext } from "@civaapple/qi-ai/context";

The compiler treats the model window, output reserve, required context, optional context, and conversation history as distinct budgets. It is deterministic and fails closed when required blocks cannot fit. Runtime-owned blocks are purpose-built least-information disclosures rather than serialized Session projections: internal IDs, authority traces, and unrelated lifecycle diagnostics stay outside model context unless an explicit bounded introspection path is authorized.

The default TokenEstimator is conservative for Unicode and callers add message/schema framing. A ModelCapabilities.tokenEstimator may supply a provider/model-calibrated deterministic estimator; one Turn must use the same estimator for ContextBlocks, messages, and Tool schemas.

The compiler result includes deterministic per-kind ContextBlock statistics for included/omitted counts and estimated tokens; callers can project composition without retaining block payloads. See docs/model/ and docs/context/ for adapter and compiler contracts.