← 返回 Skills 市场
urbantech

Ainative Sdk Quickstart

作者 Toby Morning · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
153
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install ainative-sdk-quickstart
功能描述
Get started with AINative SDKs in under 5 minutes. Use when (1) Setting up AINative for the first time, (2) Choosing between React/Next.js/Svelte/Vue SDKs, (...
使用说明 (SKILL.md)

AINative SDK Quick Start

1. Get an API Key (30 seconds)

# Auto-creates a project + API key, configures your IDE's MCP server
npx zerodb init

This outputs:

API Key: ak_...
Project ID: proj_...
MCP config written to .claude/mcp.json (or cursor/mcp.json)

Or create manually at https://app.ainative.studio → Settings → API Keys.

2. Choose Your SDK

Framework Package Hook/API
React @ainative/react-sdk useChat, useCredits
Next.js @ainative/next-sdk Server client + middleware
Svelte @ainative/svelte-sdk Svelte stores
Vue @ainative/vue-sdk Composables
Raw API requests / fetch REST directly

3. React

npm install @ainative/react-sdk
import { AINativeProvider, useChat } from '@ainative/react-sdk';

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

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

  return (
    \x3Cdiv>
      {messages.map((m, i) => \x3Cdiv key={i}>{m.role}: {m.content}\x3C/div>)}
      \x3Cbutton onClick={() => sendMessage([...messages, { role: 'user', content: 'Hello' }])}
              disabled={isLoading}>
        Send
      \x3C/button>
    \x3C/div>
  );
}

4. Next.js

npm install @ainative/next-sdk
// app/api/chat/route.ts
import { createServerClient } from '@ainative/next-sdk/server';

export async function POST(request: Request) {
  const { messages } = await request.json();
  const client = createServerClient({ apiKey: process.env.AINATIVE_API_KEY! });

  const result = await client.chat.completions.create({
    model: 'claude-3-5-sonnet-20241022',
    messages,
    stream: true,
  });

  return new Response(result.body, {
    headers: { 'Content-Type': 'text/event-stream' },
  });
}

5. Svelte

npm install @ainative/svelte-sdk
\x3Cscript>
  import { createChatStore, setAINativeConfig } from '@ainative/svelte-sdk';

  setAINativeConfig({ apiKey: 'ak_your_key' });
  const chat = createChatStore({ model: 'claude-3-5-sonnet-20241022' });
\x3C/script>

{#each $chat.messages as msg}
  \x3Cp>\x3Cb>{msg.role}:\x3C/b> {msg.content}\x3C/p>
{/each}
\x3Cbutton on:click={() => chat.sendMessage([...$chat.messages, { role: 'user', content: 'Hi' }])}>
  Send
\x3C/button>

6. Vue

npm install @ainative/vue-sdk
\x3Cscript setup>
import { useChat } from '@ainative/vue-sdk';
import { provideAINative } from '@ainative/vue-sdk';

provideAINative({ apiKey: 'ak_your_key' });
const { messages, sendMessage, isLoading } = useChat({ model: 'claude-3-5-sonnet-20241022' });
\x3C/script>

\x3Ctemplate>
  \x3Cdiv v-for="(msg, i) in messages" :key="i">{{ msg.role }}: {{ msg.content }}\x3C/div>
  \x3Cbutton @click="sendMessage([...messages, { role: 'user', content: 'Hi' }])" :disabled="isLoading">
    Send
  \x3C/button>
\x3C/template>

7. Environment Variables

# .env
AINATIVE_API_KEY=ak_your_key
NEXT_PUBLIC_AINATIVE_API_KEY=ak_your_key  # Next.js client-side

References

  • packages/sdks/react/ — React SDK source
  • packages/sdks/nextjs/ — Next.js SDK source
  • packages/sdks/svelte/ — Svelte SDK source
  • packages/sdks/vue/ — Vue SDK source
  • packages/zerodb-cli/ — zerodb init source
安全使用建议
This skill is a standard quickstart: it shows npm installs, an npx command that auto-creates API keys and writes a local config, and uses environment variables. Before running anything (especially npx zerodb init): 1) Verify the zerodb-cli/ainative npm packages and their repository/homepage to ensure they are the official project; 2) Prefer creating API keys manually via the web console if you don't trust an automated CLI; 3) Do not put sensitive server keys in client-exposed env vars (NEXT_PUBLIC_*) unless the key is explicitly designed to be public/limited; and 4) Inspect any files written to your filesystem (e.g., .claude/mcp.json) to understand what credentials are stored and where.
能力评估
Purpose & Capability
Name/description (AINative SDK quickstart) matches the SKILL.md: it shows how to get an API key, install SDK packages, and make a first API call for React/Next/Svelte/Vue. It does not request unrelated credentials or unusual system access.
Instruction Scope
The instructions stay within SDK setup scope (npm install, npx zerodb init, env vars, and example code). They do mention the zerodb init command writing an MCP config to .claude/mcp.json (or cursor/mcp.json) and show using AINATIVE_API_KEY and NEXT_PUBLIC_AINATIVE_API_KEY — which is expected for a quickstart but worth noting because NEXT_PUBLIC_* keys are client-exposed.
Install Mechanism
No formal install spec in the skill bundle (instruction-only). The doc instructs running npm install and npx zerodb init; this is normal for a quickstart but running npx executes remote package code from npm, so users should verify the zerodb-cli package/repo before running.
Credentials
The skill declares no required env vars (reasonable), but examples reference AINATIVE_API_KEY and NEXT_PUBLIC_AINATIVE_API_KEY. These are proportionate to the task, though exposing a secret via NEXT_PUBLIC_* will make it public to clients and may be inappropriate depending on key capabilities.
Persistence & Privilege
always is false and there is no install or code that requests persistent privileges or modifies other skills or system-wide settings. The skill is instruction-only and does not ask to be always-enabled.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ainative-sdk-quickstart
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ainative-sdk-quickstart 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Quickstart guide for AINative SDKs. - Covers setup and first API call for React, Next.js, Svelte, and Vue SDKs. - Includes instructions to obtain an API key and project ID. - Provides example code snippets for each framework. - Documents zerodb-cli init for fast project setup. - Lists relevant environment variables and source locations.
元数据
Slug ainative-sdk-quickstart
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Ainative Sdk Quickstart 是什么?

Get started with AINative SDKs in under 5 minutes. Use when (1) Setting up AINative for the first time, (2) Choosing between React/Next.js/Svelte/Vue SDKs, (... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 153 次。

如何安装 Ainative Sdk Quickstart?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ainative-sdk-quickstart」即可一键安装,无需额外配置。

Ainative Sdk Quickstart 是免费的吗?

是的,Ainative Sdk Quickstart 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Ainative Sdk Quickstart 支持哪些平台?

Ainative Sdk Quickstart 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Ainative Sdk Quickstart?

由 Toby Morning(@urbantech)开发并维护,当前版本 v1.0.0。

💬 留言讨论