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

@kivacore/ai-sdk-provider

v0.3.0

Published

AI SDK provider and chat transport for Kiva AI agent endpoints

Readme

@kivacore/ai-sdk-provider

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

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

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

Installation

pnpm add @kivacore/ai-sdk-provider ai @ai-sdk/provider

AI SDK 6 (ai >=6.0.116 <7) and AI SDK 7 are supported. The provider retains the LanguageModelV3 / ProviderV3 contracts; AI SDK 7 adapts these contracts automatically. Use @ai-sdk/provider 3 with AI SDK 6, or version 4 with AI SDK 7. New version-4-only model capabilities are not exposed by this provider.

Usage

import { createKivaProvider } from '@kivacore/ai-sdk-provider';

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

streamText

import { streamText } from 'ai';

const kiva = createKivaProvider({
  providerBaseURL: 'https://api.kiva.app/v1/ai/provider',
  headers: {
    Authorization: 'Bearer YOUR_KIVA_ACCESS_TOKEN',
  },
});

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

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

generateText

import { generateText } from 'ai';

const kiva = createKivaProvider({
  providerBaseURL: 'https://api.kiva.app/v1/ai/provider',
  headers: {
    Authorization: 'Bearer YOUR_KIVA_ACCESS_TOKEN',
  },
});

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

console.log(result.text);

useChat

import { useChat } from '@ai-sdk/react';
import { createKivaProvider } from '@kivacore/ai-sdk-provider';

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

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

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

The transport sends:

  • messages: a Kiva-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.kivaProvider on the streamed UI message response (the older messageMetadata.docyrusProvider name is also read)

Recommended shape:

{
  kivaProvider: {
    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',
    },
  },
}

Backend-executed tool calls that are not declared in the caller's tools must set providerExecuted: true and dynamic: true on their tool-input-available UI-message chunks (and corresponding tool output chunks). This lets AI SDK 6 and 7 surface Kiva-managed tools without trying to validate or execute them as client-defined tools.

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

Migrating from the Docyrus names

Earlier versions used Docyrus in export names and the provider id. The old export names still work but are deprecated, and they will be removed in a future major release.

| Before | Now | | --- | --- | | createDocyrusProvider | createKivaProvider | | DocyrusProvider, CreateDocyrusProviderOptions, DocyrusChatTransportOptions and the other Docyrus* types | KivaProvider, CreateKivaProviderOptions, KivaChatTransportOptions, … |

The default endpoints are now https://api.kiva.app/v1/ai/chat and https://api.kiva.app/v1/ai/provider (they were on api.docyrus.com). The language model's provider id is now 'kiva' (it was 'docyrus'). Stream metadata is read from messageMetadata.kivaProvider, and the old messageMetadata.docyrusProvider field is still read.