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

@flop-labs/contracts

v0.2.0

Published

Generated structural contracts for FLOP's public inference HTTP API

Readme

@flop-labs/contracts

Structural types, JSON Schema exports, and assertion validators for the FLOP public HTTP API. Version 0.1.0 covers listModels, getModel, and JSON createChatCompletion payloads and streaming frames from services/rest-gateway/openapi.yaml. The unreleased surface also includes exact-ID credential receipt lookup.

npm install @flop-labs/contracts
import { assertModelList, type ModelList } from "@flop-labs/contracts";

const response = await fetch("https://gateway.devnet.flop.network/v1/models");
const value: unknown = await response.json();
assertModelList(value);
const models: ModelList = value;

Exports: Model, ModelList (also ModelListResponse), ModelResponse, ChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunk, and ChatCompletionStreamError; their assert* functions and *Schema objects. Invalid data throws ContractValidationError; its message contains the contract name, never the submitted values.

CredentialReceipt, CredentialReceiptError and CredentialReceiptRequestId also export assert* functions and *Schema objects, generated from GET /keys/me/receipts/{request_id}. A receipt is a current scoped ledger observation; it does not rewrite the original completion checkpoint. Exact terminal allocations use settled_spend_raw decimal strings in raw FLOP units (10^18 raw = 1 FLOP). Unavailable values remain null. A pooled channel event is not a separate payment or burn transaction for each request. See the client's recovery example for authority, state, retention and manual replay rules.

Validation checks structure without coercion, default insertion, or removal of fields. Responses allow extensions, including receipt evidence, exactly as the source schemas allow. Validating an envelope does not authenticate its evidence, verify a receipt, or establish settlement/finality. Request validation follows the API schema. ChatCompletionStreamUsage and ChatCompletionToolCallFragment also have types, assert* functions and *Schema objects. assertChatCompletionStreamError covers in-band broker errors (including estimated usage and retry hints), session expiry, and receipt reconciliation failures; it does not validate arbitrary HTTP error bodies.

OpenAPI 3.1 models the SSE wire body as a string and references decoded data schemas through x-sse-data-schema. The literal [DONE] is a framing sentinel rather than a JSON chunk. Structural assertions validate individual frames; @flop-labs/client additionally enforces ordering, identity consistency, complete tool-call assembly, and terminal behavior. Estimated error usage does not become receipt evidence by passing validation.

The published ESM package has no runtime dependencies. Types are generated with json-schema-to-typescript; AJV generates standalone JSON Schema 2020-12 validators. Generation fails if validators start requiring runtime helpers, so a schema change cannot silently introduce a dependency.

From the repository root:

pnpm --filter @flop-labs/contracts generate
pnpm --filter @flop-labs/contracts check:generated
pnpm --filter @flop-labs/contracts build
pnpm --filter @flop-labs/contracts test

Generated files are checked in. Edit the canonical OpenAPI schemas, regenerate, and review their consumer impact together. Schema identities and package versions describe this contract artifact; they do not assert server or runtime compatibility.