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

opencloud-platform-sdk

v1.3.0

Published

Official SDK for OpenCloud - AI App Marketplace

Downloads

298

Readme

@opencloud/sdk

Official SDK for OpenCloud - The AI App Marketplace with pay-per-use model.

Build AI-powered apps that automatically handle payments and AI API calls through OpenCloud's platform.

Features

  • ✅ Call 100+ AI models (GPT-4, Claude, Gemini, Llama, etc.) via OpenRouter
  • ✅ Automatic payment processing (70% to creators, 30% to platform)
  • ✅ No API keys needed - OpenCloud handles everything
  • ✅ TypeScript support with full type definitions
  • ✅ Works in browsers and Node.js
  • ✅ Zero dependencies

Installation

npm install @opencloud/sdk
# or
pnpm add @opencloud/sdk
# or
yarn add @opencloud/sdk

Quick Start

For React/Next.js Apps

import { opencloud } from '@opencloud/sdk';

// Initialize with your app ID
opencloud.init({ appId: 'your-app-slug' });

// Call AI models
const response = await opencloud.callAI({
  model: 'openai/gpt-4',
  prompt: 'Write a tagline for my startup'
});

console.log(response.text); // AI-generated response
console.log(response.cost); // $0.10 (or your app's price per use)

For HTML/Vanilla JS

<script src="https://opencloud.com/sdk/platform-sdk.js"></script>

<script>
  PlatformSDK.init({ appId: 'your-app-slug' });

  async function generate() {
    const result = await PlatformSDK.callAI({
      model: 'anthropic/claude-3-5-sonnet',
      prompt: 'Generate a logo description'
    });

    console.log(result.text);
  }
</script>

API Reference

opencloud.init(config)

Initialize the SDK with your app configuration.

opencloud.init({
  appId: 'your-app-slug',  // Required: Your app's unique identifier
  apiUrl: 'https://opencloud.com'  // Optional: Platform URL (defaults to current origin)
});

opencloud.callAI(params)

Call an AI model through OpenCloud's platform.

const response = await opencloud.callAI({
  model: 'openai/gpt-4',  // Required: Model identifier
  prompt: 'Your prompt here',  // Required: The prompt to send
  options: {  // Optional: Additional model parameters
    temperature: 0.7,
    max_tokens: 1000
  }
});

// Response structure:
{
  success: true,
  text: "AI-generated response...",
  usage: {
    promptTokens: 10,
    completionTokens: 50,
    totalTokens: 60
  },
  cost: 0.10,  // Amount charged to user
  model: "openai/gpt-4"
}

opencloud.getBalance()

Get the current user's token balance.

const balance = await opencloud.getBalance();
console.log(`Balance: $${balance}`);

opencloud.requestTopUp()

Request the user to purchase more tokens (opens payment dialog).

try {
  await opencloud.callAI({...});
} catch (error) {
  if (error.message.includes('Insufficient balance')) {
    await opencloud.requestTopUp();
  }
}

Supported AI Models

OpenCloud uses OpenRouter, giving you access to 100+ models:

OpenAI:

  • openai/gpt-4
  • openai/gpt-4-turbo
  • openai/gpt-3.5-turbo

Anthropic:

  • anthropic/claude-3-5-sonnet
  • anthropic/claude-3-haiku
  • anthropic/claude-3-opus

Google:

  • google/gemini-pro
  • google/gemini-pro-vision

Meta:

  • meta-llama/llama-3-70b
  • meta-llama/llama-3-8b

And many more! See OpenRouter docs for full list.

Example Apps

Text Summarizer

import { opencloud } from '@opencloud/sdk';

opencloud.init({ appId: 'text-summarizer' });

async function summarize(text: string) {
  const response = await opencloud.callAI({
    model: 'anthropic/claude-3-haiku',  // Fast and cheap
    prompt: `Summarize this text in 3 bullet points:\n\n${text}`
  });

  return response.text;
}

Image Description Generator

import { opencloud } from '@opencloud/sdk';

opencloud.init({ appId: 'image-describer' });

async function describeImage(imageUrl: string) {
  const response = await opencloud.callAI({
    model: 'google/gemini-pro-vision',
    prompt: 'Describe this image in detail',
    options: {
      image: imageUrl
    }
  });

  return response.text;
}

Revenue Model

OpenCloud uses a 70/30 revenue split:

  • 70% goes to you (the app creator)
  • 30% goes to OpenCloud (platform fee)

Example:

User pays:     $0.10 per use
AI cost:       -$0.03 (OpenAI API)
Net revenue:   $0.07
├─ You get:    $0.049 (70%)
└─ Platform:   $0.021 (30%)

TypeScript Support

Full TypeScript definitions included:

import {
  opencloud,
  OpenCloudSDK,
  AICallParams,
  AIResponse,
  OpenCloudConfig
} from '@opencloud/sdk';

const params: AICallParams = {
  model: 'openai/gpt-4',
  prompt: 'Hello world'
};

const response: AIResponse = await opencloud.callAI(params);

Publishing Your App

  1. Build your app with the SDK
  2. Go to opencloud.com/publish
  3. Upload your app or connect GitHub
  4. Set pricing and details
  5. Test with $5 free credits
  6. Publish to marketplace!

Support

License

MIT © OpenCloud