← Back to Skills Marketplace
urbantech

Ainative React Sdk

by Toby Morning · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
139
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install ainative-react-sdk
Description
Use @ainative/react-sdk to add AI chat and credits to React apps. Use when (1) Installing @ainative/react-sdk, (2) Using the useChat hook for chat completion...
README (SKILL.md)

@ainative/react-sdk

React hooks and components for AINative — chat completions, credit tracking, and managed sessions.

Install

npm install @ainative/react-sdk

Setup: AINativeProvider

Wrap your app (or a subtree) with the provider:

import { AINativeProvider } from '@ainative/react-sdk';

function App() {
  return (
    \x3CAINativeProvider config={{ apiKey: 'ak_your_key' }}>
      \x3CYourApp />
    \x3C/AINativeProvider>
  );
}

useChat Hook

import { useChat } from '@ainative/react-sdk';
import type { Message } from '@ainative/react-sdk';

function ChatUI() {
  const { messages, isLoading, error, sendMessage } = useChat({
    model: 'claude-3-5-sonnet-20241022',
    temperature: 0.7,
    max_tokens: 1024,
  });

  const handleSend = async (input: string) => {
    await sendMessage([
      ...messages,
      { role: 'user', content: input }
    ]);
  };

  return (
    \x3Cdiv>
      {messages.map((msg, i) => (
        \x3Cdiv key={i} className={`message ${msg.role}`}>
          \x3Cstrong>{msg.role}:\x3C/strong> {msg.content}
        \x3C/div>
      ))}
      {isLoading && \x3Cdiv>Thinking...\x3C/div>}
      {error && \x3Cdiv className="error">Error: {error.message}\x3C/div>}
      \x3Cinput
        onKeyDown={(e) => e.key === 'Enter' && handleSend(e.currentTarget.value)}
        placeholder="Type a message..."
      />
    \x3C/div>
  );
}

useChat Options

Option Type Default Description
model string Model ID (e.g. claude-3-5-sonnet-20241022)
temperature number 0.7 Randomness (0–1)
max_tokens number 1024 Max response tokens

useChat Return

Field Type Description
messages Message[] Full conversation history
isLoading boolean True while request in flight
error AINativeError | null Last error, if any
sendMessage (msgs: Message[]) => Promise\x3C...> Send next message

useCredits Hook

import { useCredits } from '@ainative/react-sdk';

function CreditsBar() {
  const { balance, isLoading, error, refetch } = useCredits();

  if (isLoading) return \x3Cdiv>Loading credits...\x3C/div>;
  if (error) return \x3Cdiv>Error: {error.message}\x3C/div>;

  return (
    \x3Cdiv>
      \x3Cspan>{balance?.remaining_credits} credits remaining\x3C/span>
      \x3Cspan> | Plan: {balance?.plan}\x3C/span>
      \x3Cbutton onClick={refetch}>Refresh\x3C/button>
    \x3C/div>
  );
}

useCredits Return

Field Type Description
balance CreditBalance | null Balance data
isLoading boolean Fetching state
error AINativeError | null Error state
refetch () => void Manually refresh

CreditBalance shape: { remaining_credits: number, plan: string, ... }

Exports

import {
  AINativeProvider,
  useChat,
  useCredits,
  useAINativeContext,  // access raw config/baseUrl
  type Message,
  type ChatCompletionResponse,
  type CreditBalance,
  type AINativeError,
  type UseChatOptions,
} from '@ainative/react-sdk';

Environment Variable (CRA / Vite)

REACT_APP_AINATIVE_API_KEY=ak_your_key   # CRA
VITE_AINATIVE_API_KEY=ak_your_key        # Vite
\x3CAINativeProvider config={{ apiKey: process.env.REACT_APP_AINATIVE_API_KEY! }}>

References

  • packages/sdks/react/src/hooks/useChat.ts — Hook implementation
  • packages/sdks/react/src/hooks/useCredits.ts — Credits hook
  • packages/sdks/react/src/AINativeProvider.tsx — Provider context
  • packages/sdks/react/src/index.ts — Package exports
Usage Guidance
This instruction-only skill appears to be what it claims (a React SDK for chat and credits), but do a quick provenance check before using it in production: 1) Verify the package on the npm registry (owner, package page, readme, and published version) and confirm the maintainer/trustworthiness since source/homepage are missing. 2) Confirm the correct published version (SKILL.md says 1.0.1 vs metadata 1.0.0). 3) Treat the API key (REACT_APP_AINATIVE_API_KEY / VITE_AINATIVE_API_KEY or provider apiKey) as sensitive: store it in secure env/config and avoid embedding it in client bundles. 4) Inspect the installed package contents (node_modules/@ainative/react-sdk) and its network calls to ensure it only talks to expected endpoints. If you cannot validate the package origin, avoid providing secrets to it.
Capability Analysis
Type: OpenClaw Skill Name: ainative-react-sdk Version: 1.0.0 The skill bundle contains standard documentation and usage examples for a React SDK (@ainative/react-sdk). The SKILL.md file provides clear instructions for an AI agent to assist with installing the package, setting up a provider, and using hooks for chat and credit tracking. No malicious code, data exfiltration patterns, or prompt injection attempts were identified.
Capability Assessment
Purpose & Capability
SKILL.md shows a React provider, useChat and useCredits hooks and usage examples that match the skill name/description. Minor inconsistencies: SKILL.md header says published npm v1.0.1 while registry metadata lists version 1.0.0; source and homepage are missing which makes provenance unclear but not contradictory to the documented functionality.
Instruction Scope
Instructions are focused on installing and using the @ainative/react-sdk in a React app (provider config, hooks, env var examples). The runtime instructions do not ask the agent to read unrelated system files or exfiltrate data.
Install Mechanism
This is an instruction-only skill that tells the user to run 'npm install @ainative/react-sdk'. There is no install spec that would download arbitrary archives or write code to disk beyond normal package installation.
Credentials
SKILL.md demonstrates the SDK expects an API key (REACT_APP_AINATIVE_API_KEY / VITE_AINATIVE_API_KEY and a provider config apiKey). However, the skill's metadata lists no required env vars or primary credential. The SDK legitimately needs an API key for operation, so the metadata omission is a provenance/documentation gap rather than a functional impossibility.
Persistence & Privilege
Skill is not flagged always:true and does not request persistent or elevated privileges. It's user-invocable and model invocation is enabled (normal for skills).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ainative-react-sdk
  3. After installation, invoke the skill by name or use /ainative-react-sdk
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial public release of ainative-react-sdk. - Provides React hooks for AI chat (useChat), credit tracking (useCredits), and managed sessions via AINativeProvider. - Includes TypeScript types and context access (useAINativeContext). - Documentation covers installation, hook usage, provider setup, handling loading/error states, and environment variable configuration. - Published as @ainative/react-sdk version 1.0.1 on npm.
Metadata
Slug ainative-react-sdk
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Ainative React Sdk?

Use @ainative/react-sdk to add AI chat and credits to React apps. Use when (1) Installing @ainative/react-sdk, (2) Using the useChat hook for chat completion... It is an AI Agent Skill for Claude Code / OpenClaw, with 139 downloads so far.

How do I install Ainative React Sdk?

Run "/install ainative-react-sdk" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Ainative React Sdk free?

Yes, Ainative React Sdk is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Ainative React Sdk support?

Ainative React Sdk is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Ainative React Sdk?

It is built and maintained by Toby Morning (@urbantech); the current version is v1.0.0.

💬 Comments