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

@ad-rian-studio/ai-client

v0.1.0

Published

Official TypeScript SDK helper for AD-RIAN Studio AI API

Downloads

220

Readme

AD-RIAN Studio AI Client

Official TypeScript SDK helper for interacting with the AD-RIAN Studio AI API.

Works in Node.js, Deno, Bun, modern browsers, Next.js, Cloudflare Workers, Vercel Edge functions, and React applications (@ai-sdk/react).


Installation

Install from npm:

# npm
npm install @ad-rian-studio/ai-client

# pnpm
pnpm add @ad-rian-studio/ai-client

# yarn
yarn add @ad-rian-studio/ai-client

# bun
bun add @ad-rian-studio/ai-client

Then import it in your code:

import { createClient } from '@ad-rian-studio/ai-client';

Quick Start

1. Non-Streaming Request

import { createClient } from '@ad-rian-studio/ai-client';

const ai = createClient({
  apiKey: process.env.CHAT_API_KEY, // optional for public endpoints
});

async function main() {
  const response = await ai.sendMessage('Tell me about AD-RIAN Studio.');
  console.log('Model:', response.model);
  console.log('Answer:', response.text);
  console.log('Tokens used:', response.usage);
}

main();

2. Streaming Request

import { AdrianStudioAI } from '@ad-rian-studio/ai-client';

const ai = new AdrianStudioAI({ apiKey: process.env.CHAT_API_KEY });

async function streamResponse() {
  const response = await ai.sendMessageStream('What projects are featured?');

  // Response body contains the Vercel AI SDK UI message stream
  const reader = response.body?.getReader();
  const decoder = new TextDecoder();

  while (reader) {
    const { done, value } = await reader.read();
    if (done) break;
    console.log(decoder.decode(value));
  }
}

3. Vercel AI SDK & React Integration (@ai-sdk/react)

Use getChatTransport() to connect @ai-sdk/react's useChat directly:

import { useChat } from '@ai-sdk/react';
import { AdrianStudioAI } from '@ad-rian-studio/ai-client';

const ai = new AdrianStudioAI();

export function ChatComponent() {
  const { messages, sendMessage } = useChat({
    transport: ai.getChatTransport(),
    body: {
      variant: 'pro',
    },
  });

  return (
    <div>
      {messages.map((m) => (
        <div key={m.id}>
          <strong>{m.role}:</strong>{' '}
          {m.parts.map((p) => (p.type === 'text' ? p.text : '')).join('')}
        </div>
      ))}
    </div>
  );
}

4. Models, Providers & Mappings

The library exports the complete model registry and provider mappings used by AD-RIAN Studio:

import {
  modelRegistry,
  MODEL_PROVIDER_MAP,
  PROVIDER_MODELS_MAP,
  getModelById,
  getModelsByProvider,
  getModelsByCategory,
  type ProviderString,
  type ModelId,
  type ModelCategory,
} from '@ad-rian-studio/ai-client';

// Look up model metadata by ID
const model = getModelById('google-gemini-flash');
console.log(model?.label, model?.provider, model?.supportsTools);

// Get all models for a specific provider
const openrouterModels = getModelsByProvider('openrouter');

// Get all models in the 'pro' variant category
const proModels = getModelsByCategory('pro');

// Quick lookup maps
const providerName = MODEL_PROVIDER_MAP['opencode-zen-deepseek-v4-flash']; // 'opencode-zen'

Exported API

  • Client: AdrianStudioAI, AdrianStudioAPIError, createClient(), DEFAULT_BASE_URL, normalizeBaseURL().
  • API Types: ChatRequestBody, ChatTextResponse, ApiToolDefinition, ApiToolMap, ApiToolInputSchema, ApiToolError, AIError, AIResponse, AdrianStudioClientOptions, ChatOptions, UIMessage.
  • Models & Providers: modelRegistry, MODEL_PROVIDER_MAP, PROVIDER_MODELS_MAP, getModelById(), getModelsByProvider(), getModelsByCategory(), ProviderString, ModelCategory, ModelRegistryEntry, ModelId, ModelString.
  • Tool Utilities: isMasterTool(name), stripMasterPrefix(name), masterName(name), createToolError(msg, retryable).
  • Adapters: createAdrianStudioTransport(options).

Error Handling

Non-2xx responses from the API throw an AdrianStudioAPIError:

import { AdrianStudioAPIError, createClient } from '@ad-rian-studio/ai-client';

const ai = createClient({ apiKey: process.env.CHAT_API_KEY });

try {
  await ai.sendMessage('Hello!');
} catch (error) {
  if (error instanceof AdrianStudioAPIError) {
    console.error(`Request failed (${error.status}):`, error.message);
  }
}

Development

  • pnpm install — install dependencies
  • pnpm typecheck — type check without emitting files
  • pnpm build — build dual ESM/CommonJS output with TypeScript declarations in dist/
  • pnpm test — run offline unit tests via Vitest
  • pnpm test:watch — run unit tests in interactive watch mode
  • pnpm test:live -- --api-key <YOUR_KEY> — run live integration tests against the live API
  • pnpm test:all — run all unit and live tests

License

MIT