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

@lucid-agents/api-sdk

v2.5.0

Published

TypeScript SDK for the Lucid Agents Runtime API (auto-generated from OpenAPI)

Readme

@lucid-agents/api-sdk

TypeScript SDK for the Lucid Agents Runtime API. This SDK is automatically generated from the OpenAPI specification.

Installation

npm install @lucid-agents/api-sdk
# or
bun add @lucid-agents/api-sdk
# or
pnpm add @lucid-agents/api-sdk

Usage

Basic Client

import { createClient, createConfig } from '@lucid-agents/api-sdk/client';

const client = createClient(
  createConfig({
    baseUrl: 'https://api-lucid-dev.daydreams.systems',
    // Optional: Add authentication headers
    headers: {
      'Authorization': 'Bearer your-token',
    },
  })
);

// List agents
const agents = await client.GET('/api/agents', {
  params: {
    query: {
      limit: 10,
      offset: 0,
    },
  },
});

// Create an agent
const newAgent = await client.POST('/api/agents', {
  body: {
    name: 'My Agent',
    slug: 'my-agent',
    description: 'A test agent',
    version: '1.0.0',
    entrypoints: [],
  },
});

// Invoke an entrypoint
const result = await client.POST('/agents/{agentId}/entrypoints/{entrypointKey}/invoke', {
  params: {
    path: {
      agentId: 'agent-123',
      entrypointKey: 'echo',
    },
  },
  body: {
    input: { text: 'Hello, world!' },
  },
});

React Query Integration

If you're using React Query, you can use the generated hooks:

import { useQuery, useMutation } from '@tanstack/react-query';
import { getApiAgentsOptions, useGetApiAgents } from '@lucid-agents/api-sdk/react-query';

// Using the hook directly
function AgentsList() {
  const { data, isLoading, error } = useGetApiAgents({
    params: {
      query: {
        limit: 10,
      },
    },
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <ul>
      {data?.agents.map(agent => (
        <li key={agent.id}>{agent.name}</li>
      ))}
    </ul>
  );
}

// Or using query options for more control
function AgentsListAdvanced() {
  const queryOptions = getApiAgentsOptions({
    params: {
      query: { limit: 10 },
    },
  });

  const { data } = useQuery(queryOptions);
  // ...
}

Authentication

The SDK supports multiple authentication methods:

Session-based (Better Auth)

const client = createClient(
  createConfig({
    baseUrl: 'https://api-lucid-dev.daydreams.systems',
    fetch: (url, init) => {
      return fetch(url, {
        ...init,
        credentials: 'include', // Include cookies for session auth
      });
    },
  })
);

Token-based

const client = createClient(
  createConfig({
    baseUrl: 'https://api-lucid-dev.daydreams.systems',
    headers: {
      'Authorization': `Bearer ${token}`,
    },
  })
);

Payment-based (x402)

For agent-to-agent authentication via x402 payments:

const client = createClient(
  createConfig({
    baseUrl: 'https://api-lucid-dev.daydreams.systems',
    headers: {
      'PAYMENT-SIGNATURE': paymentSignature, // Base64-encoded payment signature
    },
  })
);

API Reference

The SDK provides type-safe access to all endpoints defined in the OpenAPI specification:

  • Agents: Create, read, update, delete agents
  • Invocation: Invoke agent entrypoints
  • Analytics: Get usage and payment analytics
  • Identity: Manage ERC-8004 agent identity
  • Rankings: Get live agent rankings
  • Secrets: Manage encrypted secrets (if enabled)

See the OpenAPI documentation for full endpoint details.

Generating the SDK

To regenerate the SDK from the OpenAPI spec:

# Set the OpenAPI URL (defaults to https://api-lucid-dev.daydreams.systems/doc)
export OPENAPI_URL=https://api.example.com/doc

# Generate the SDK
bun run generate

The SDK is automatically regenerated via CI when the API specification changes.

Type Safety

All request and response types are automatically generated from the OpenAPI schema, ensuring full type safety:

// Type-safe - TypeScript will catch errors
const result = await client.POST('/api/agents', {
  body: {
    name: 'My Agent',
    slug: 'my-agent',
    // TypeScript error: missing required field 'entrypoints'
  },
});

// Response types are inferred
const agents = await client.GET('/api/agents');
// agents.data is typed as AgentListResponse

Error Handling

The SDK uses standard HTTP status codes. Check the response status:

const response = await client.GET('/api/agents/{agentId}', {
  params: {
    path: { agentId: 'invalid-id' },
  },
});

if (response.error) {
  // Handle error
  console.error(response.error);
} else {
  // Use data
  console.log(response.data);
}

License

MIT