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

@daydreamsai/ai-sdk-provider

v0.1.5

Published

Dreams Router AI SDK provider (forked from OpenRouter)

Downloads

38

Readme

Dreams Router Provider for Vercel AI SDK

Dreams Router is an AI model router with built‑in x402 payments for the Vercel AI SDK. It supports EVM and Solana, API keys or wallet auth, and auto‑generates exact payment headers from server requirements.

🌟 Key Features

  • Payment-Integrated AI: Send USDC payments directly within API requests using the x402 protocol
  • Multiple Authentication Methods: Use JWT, API Key, or inline payments
  • LLM Router: Access various AI models through a unified interface
  • Account Management: Create and manage your account at router.daydreams.systems

📋 Prerequisites

  • Account at router.daydreams.systems
  • One of: API key, account credit, or a wallet with USDC (router returns amounts; you don’t set them manually)

📦 Installation

npm install @daydreamsai/ai-sdk-provider viem x402

🚀 Quick Start

Separated Auth (clean EVM/Solana helpers)

import { generateText } from 'ai';
import {
  createEVMAuthFromPrivateKey,
  createSolanaAuthFromPublicKey,
} from '@daydreamsai/ai-sdk-provider';

// EVM (Ethereum, Base, etc.)
const { dreamsRouter } = await createEVMAuthFromPrivateKey(
  process.env.EVM_PRIVATE_KEY as `0x${string}`,
  {
    payments: { network: 'base-sepolia' },
  }
);

// Solana (browser/wallet-style: publicKey + signMessage)
const { dreamsRouter: solanaRouter } = await createSolanaAuthFromPublicKey(
  process.env.SOL_PUBLIC_KEY!,
  async ({ message }) => wallet.signMessage(message),
  {
    payments: {
      network: 'solana-devnet',
      rpcUrl: 'https://api.devnet.solana.com',
    },
  }
);

const { text } = await generateText({
  model: dreamsRouter('google-vertex/gemini-2.5-flash'),
  prompt: 'Hello from Dreams Router!',
});

🎯 Why Separated Functions?

  • Type safety per chain; chain‑specific options stay clear
  • Explicit intent (EVM vs Solana), smaller bundles

API Key Auth

import { createDreamsRouter } from '@daydreamsai/ai-sdk-provider';
import { generateText } from 'ai';

const dreamsRouter = createDreamsRouter({
  apiKey: process.env.DREAMSROUTER_API_KEY,
});

const { text } = await generateText({
  model: dreamsRouter('google-vertex/gemini-2.5-flash'),
  prompt: 'Hello, Dreams Router!',
});

Namespace .evm / .solana (Node)

import {
  createDreamsRouter,
  type SolanaSigner,
} from '@daydreamsai/ai-sdk-provider';
import { privateKeyToAccount } from 'viem/accounts';

// EVM via viem Account
const evm = createDreamsRouter.evm(
  privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`),
  { network: 'base-sepolia' }
);

// Solana via Node signer (base58 secret)
const solana = createDreamsRouter.solana(
  {
    type: 'node',
    secretKeyBase58: process.env.SOLANA_SECRET_KEY!,
    rpcUrl: process.env.SOLANA_RPC_URL,
  },
  { network: 'solana-devnet' }
);

🔐 Authentication Methods

  • x402 payments (wallet‑based, EVM or Solana)
  • API key
  • Session token (JWT) from wallet login

💡 When to Use

  • Microservices with per‑request payments
  • Pay‑per‑use apps without billing backends
  • Wallet‑native AI integrations (EVM or Solana)

🔧 Configuration

Environment

# API key auth
DREAMSROUTER_API_KEY=...

# EVM auth
EVM_PRIVATE_KEY=0x...

# Solana (Node signer)
SOLANA_SECRET_KEY=base58-encoded-64-byte-secret
SOLANA_RPC_URL=https://api.devnet.solana.com

# Solana (wallet-style)
SOL_PUBLIC_KEY=...
ROUTER_BASE_URL=https://api-beta.daydreams.systems

📚 Advanced

Payment config (auto‑requirements)

type DreamsRouterPaymentConfig = {
  network?: 'base' | 'base-sepolia' | 'solana' | 'solana-devnet';
  validityDuration?: number; // default 600s
  mode?: 'lazy' | 'eager'; // default 'lazy'
  rpcUrl?: string; // Solana only
};

Amounts and pay‑to addresses come from the router’s 402 response and are signed automatically.

Solana signer interface (Node)

type SolanaSigner = {
  type: 'node';
  secretKeyBase58: string; // 64‑byte secret, base58
  rpcUrl?: string;
};

Model selection

Use any model available in the dashboard; e.g. google-vertex/gemini-2.5-flash.

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links