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

@ainative/vue-sdk

v1.0.0

Published

Official Vue SDK for AINative Studio API - Composables for chat completions and credit management

Readme

@ainative/vue-sdk

Official Vue SDK for AINative Studio API - Composables for chat completions and credit management.

npm version License: MIT

Features

  • 🎯 Vue 3 Composition API - Modern composables for seamless integration
  • 💬 Chat Completions - Stream AI responses with useChat()
  • 💰 Credit Management - Track balance with useCredits()
  • 📘 TypeScript - Full type safety with TypeScript definitions
  • 🔄 Reactive - Built on Vue's reactivity system
  • 🪶 Lightweight - Minimal bundle size with tree-shaking support

Installation

npm install @ainative/vue-sdk

Quick Start

1. Provide Configuration

// main.ts
import { createApp } from 'vue';
import { AINativeConfigKey } from '@ainative/vue-sdk';
import App from './App.vue';

const app = createApp(App);

app.provide(AINativeConfigKey, {
  apiKey: 'your-api-key-here',
  baseUrl: 'https://api.ainative.studio' // optional
});

app.mount('#app');

2. Use Chat Composable

<script setup lang="ts">
import { ref } from 'vue';
import { useChat, type Message } from '@ainative/vue-sdk';

const { messages, isLoading, error, sendMessage, reset } = useChat({
  model: 'claude-3-5-sonnet-20241022'
});

const input = ref('');

const handleSubmit = async () => {
  if (!input.value.trim()) return;

  const userMessage: Message = {
    role: 'user',
    content: input.value
  };

  try {
    await sendMessage([...messages.value, userMessage]);
    input.value = '';
  } catch (err) {
    console.error('Failed to send message:', err);
  }
};
</script>

<template>
  <div class="chat-container">
    <div class="messages">
      <div v-for="(msg, index) in messages" :key="index" :class="`message-${msg.role}`">
        <strong>{{ msg.role }}:</strong> {{ msg.content }}
      </div>
    </div>

    <div v-if="error" class="error">
      {{ error.message }}
    </div>

    <form @submit.prevent="handleSubmit">
      <input
        v-model="input"
        :disabled="isLoading"
        placeholder="Type your message..."
      />
      <button type="submit" :disabled="isLoading || !input.trim()">
        {{ isLoading ? 'Sending...' : 'Send' }}
      </button>
    </form>

    <button @click="reset" type="button">Reset Chat</button>
  </div>
</template>

3. Use Credits Composable

<script setup lang="ts">
import { useCredits } from '@ainative/vue-sdk';

const { balance, isLoading, error, refetch } = useCredits({
  autoFetch: true
});
</script>

<template>
  <div class="credits-display">
    <div v-if="isLoading">Loading balance...</div>
    <div v-else-if="error" class="error">{{ error.message }}</div>
    <div v-else-if="balance">
      <p>Balance: {{ balance.balance }} {{ balance.currency }}</p>
      <p>User ID: {{ balance.userId }}</p>
    </div>

    <button @click="refetch" :disabled="isLoading">
      Refresh Balance
    </button>
  </div>
</template>

API Reference

useAINative()

Access the SDK configuration provided at the app level.

import { useAINative } from '@ainative/vue-sdk';

const config = useAINative();
console.log(config.apiKey, config.baseUrl);

useChat(options?)

Manage chat conversations with AI models.

Options:

  • initialMessages?: Message[] - Initial conversation messages
  • model?: string - AI model to use (default: claude-3-5-sonnet-20241022)

Returns:

  • messages: Ref<Message[]> - Chat message history
  • isLoading: Ref<boolean> - Loading state
  • error: Ref<AINativeError | null> - Error state
  • sendMessage: (messages: Message[]) => Promise<ChatCompletionResponse | null> - Send messages
  • reset: () => void - Reset conversation

useCredits(options?)

Monitor credit balance.

Options:

  • autoFetch?: boolean - Automatically fetch on mount (default: true)

Returns:

  • balance: Ref<CreditBalance | null> - Credit balance
  • isLoading: Ref<boolean> - Loading state
  • error: Ref<AINativeError | null> - Error state
  • refetch: () => Promise<void> - Manually refetch balance

TypeScript Support

Full TypeScript definitions included:

import type {
  AINativeConfig,
  Message,
  ChatCompletionResponse,
  CreditBalance,
  AINativeError,
  UseChatOptions,
  UseCreditsOptions
} from '@ainative/vue-sdk';

Examples

See the /examples directory for complete example applications:

  • Basic chat application
  • Credit monitoring dashboard
  • Multi-model comparison
  • Chat with history persistence

License

MIT © AINative Studio

Support

  • Documentation: https://api.ainative.studio/docs
  • Email: [email protected]
  • Discord: https://discord.com/invite/paipalooza
  • Issues: https://github.com/AINative-Studio/ainative-sdks/issues