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

@docyrus/ai-sdk-provider

v0.0.1

Published

AI SDK provider and chat transport for Docyrus AI agent endpoints

Downloads

46

Readme

@docyrus/ai-sdk-provider

AI SDK provider and chat transport for Docyrus AI agent endpoints.

This package exposes a single factory, createDocyrusProvider(...), that supports:

  • AI SDK Core server-side usage with generateText / streamText
  • AI SDK UI frontend usage with useChat via provider.chatTransport()

Installation

pnpm add @docyrus/ai-sdk-provider ai

Usage

import { createDocyrusProvider } from '@docyrus/ai-sdk-provider';

const docyrus = createDocyrusProvider({
  baseURL: 'https://api.docyrus.com/v1/ai/chat',
  providerBaseURL: 'https://api.docyrus.com/v1/ai/provider',
  apiKey: 'docyrus-oauth-client-id',
  headers: async () => ({
    Authorization: `Bearer ${await getAccessToken()}`,
  }),
});

streamText

import { streamText } from 'ai';

const docyrus = createDocyrusProvider({
  providerBaseURL: 'https://api.docyrus.com/v1/ai/provider',
  headers: {
    Authorization: 'Bearer YOUR_DOCYRUS_ACCESS_TOKEN',
  },
});

const result = streamText({
  model: docyrus('default'),
  prompt: 'Summarize the latest project updates.',
});

for await (const delta of result.textStream) {
  process.stdout.write(delta);
}

generateText

import { generateText } from 'ai';

const docyrus = createDocyrusProvider({
  providerBaseURL: 'https://api.docyrus.com/v1/ai/provider',
  headers: {
    Authorization: 'Bearer YOUR_DOCYRUS_ACCESS_TOKEN',
  },
});

const result = await generateText({
  model: docyrus('default'),
  prompt: 'Say hello from Docyrus.',
});

console.log(result.text);

useChat

import { useChat } from '@ai-sdk/react';
import { createDocyrusProvider } from '@docyrus/ai-sdk-provider';

const docyrus = createDocyrusProvider({
  baseURL: 'https://api.docyrus.com/v1/ai/chat',
  headers: async () => ({
    Authorization: `Bearer ${await getAccessToken()}`,
  }),
});

export function Chat() {
  const { messages, sendMessage } = useChat({
    transport: docyrus.chatTransport({
      body: {
        projectId: 'project-id',
        workId: 'work-id',
        thinkingActive: true,
      },
    }),
  });

  return (
    <div>
      <button onClick={() => sendMessage({ text: 'Hello Docyrus' })}>
        Send
      </button>
      <pre>{JSON.stringify(messages, null, 2)}</pre>
    </div>
  );
}

The transport sends:

  • messages: a Docyrus-compatible { role, content }[] projection of the UI messages
  • uiMessages: the raw AI SDK UI messages for forward-compatible backend upgrades
  • threadId: defaults to the AI SDK chat id unless you override it in body

Backend Metadata Contract

For server-side provider parity, the provider endpoint should include AI SDK response metadata in either:

  • the JSON response body
  • messageMetadata.docyrusProvider on the streamed UI message response

Recommended shape:

{
  docyrusProvider: {
    usage: {
      inputTokens: {
        total: 10,
        noCache: 10,
        cacheRead: 0,
        cacheWrite: 0,
      },
      outputTokens: {
        total: 20,
        text: 18,
        reasoning: 2,
      },
    },
    warnings: [],
    finishReason: { unified: 'stop', raw: 'stop' },
    response: {
      id: 'response-id',
      modelId: 'default',
      timestamp: '2026-03-16T12:00:00.000Z',
    },
  },
}

See docs/ai-sdk-provider-backend-contract.md for the full handoff.