← 返回 Skills 市场
Ainative Vue Sdk
作者
Toby Morning
· GitHub ↗
· v1.0.0
· MIT-0
114
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install ainative-vue-sdk
功能描述
Use @ainative/vue-sdk to add AI chat to Vue 3 apps. Use when (1) Installing @ainative/vue-sdk, (2) Using the useChat composable in Vue components, (3) Provid...
使用说明 (SKILL.md)
@ainative/vue-sdk
Vue 3 composables for AINative chat completions.
Install
npm install @ainative/vue-sdk
Setup: provideAINative
// main.ts
import { createApp } from 'vue';
import { provideAINative } from '@ainative/vue-sdk';
import App from './App.vue';
const app = createApp(App);
app.provide('ainative', {
apiKey: import.meta.env.VITE_AINATIVE_API_KEY,
baseUrl: 'https://api.ainative.studio',
});
app.mount('#app');
Or provide inside a component:
\x3Cscript setup>
import { provideAINative } from '@ainative/vue-sdk';
provideAINative({ apiKey: import.meta.env.VITE_AINATIVE_API_KEY });
\x3C/script>
useChat Composable
\x3C!-- ChatComponent.vue -->
\x3Cscript setup lang="ts">
import { ref } from 'vue';
import { useChat } from '@ainative/vue-sdk';
import type { Message } from '@ainative/vue-sdk';
const { messages, isLoading, error, sendMessage, reset } = useChat({
model: 'claude-3-5-sonnet-20241022',
initialMessages: [],
});
const input = ref('');
async function send() {
if (!input.value.trim()) return;
const newMessages: Message[] = [
...messages.value,
{ role: 'user', content: input.value }
];
input.value = '';
await sendMessage(newMessages);
}
\x3C/script>
\x3Ctemplate>
\x3Cdiv>
\x3Cdiv v-for="(msg, i) in messages" :key="i" :class="['message', msg.role]">
\x3Cstrong>{{ msg.role }}:\x3C/strong> {{ msg.content }}
\x3C/div>
\x3Cdiv v-if="isLoading">Thinking...\x3C/div>
\x3Cdiv v-if="error" class="error">Error: {{ error.message }}\x3C/div>
\x3Cinput
v-model="input"
@keydown.enter="send"
placeholder="Type a message..."
/>
\x3Cbutton @click="send" :disabled="isLoading">Send\x3C/button>
\x3Cbutton @click="reset">Reset\x3C/button>
\x3C/div>
\x3C/template>
useChat Options
| Option | Type | Default | Description |
|---|---|---|---|
model |
string | — | Model ID (e.g. claude-3-5-sonnet-20241022) |
initialMessages |
Message[] |
[] |
Seed the conversation |
useChat Return
| Field | Type | Description |
|---|---|---|
messages |
Ref\x3CMessage[]> |
Reactive message list |
isLoading |
Ref\x3Cboolean> |
True during request |
error |
Ref\x3CAINativeError | null> |
Last error |
sendMessage |
(msgs: Message[]) => Promise\x3C...> |
Send next turn |
reset |
() => void |
Clear conversation |
useCredits Composable
\x3Cscript setup>
import { useCredits } from '@ainative/vue-sdk';
const { balance, isLoading, error, refetch } = useCredits();
\x3C/script>
\x3Ctemplate>
\x3Cdiv v-if="!isLoading">
Credits: {{ balance?.remaining_credits }} | Plan: {{ balance?.plan }}
\x3Cbutton @click="refetch">Refresh\x3C/button>
\x3C/div>
\x3C/template>
Nuxt Integration
// plugins/ainative.client.ts
import { provideAINative } from '@ainative/vue-sdk';
export default defineNuxtPlugin(() => {
provideAINative({ apiKey: useRuntimeConfig().public.ainativeApiKey });
});
// nuxt.config.ts
export default defineNuxtConfig({
runtimeConfig: {
public: { ainativeApiKey: process.env.VITE_AINATIVE_API_KEY }
}
});
Exports
import {
useChat,
useCredits,
useAINative,
provideAINative,
type Message,
type UseChatOptions,
type UseChatReturn,
type AINativeError,
} from '@ainative/vue-sdk';
References
packages/sdks/vue/src/composables/useChat.ts— useChat implementationpackages/sdks/vue/src/composables/useCredits.ts— useCredits implementationpackages/sdks/vue/src/composables/useAINative.ts— Config injectionpackages/sdks/vue/src/index.ts— Package exports
安全使用建议
This skill's README looks like ordinary usage documentation for a Vue SDK, but be aware of two points before installing/using it: (1) The examples require an AINative API key and send chat data to https://api.ainative.studio — confirm you trust that service and its privacy practices. (2) The skill metadata does not declare the API key as a required env var; that mismatch could be an oversight. Do these steps before proceeding: verify the npm package @ainative/vue-sdk exists on the public registry and inspect its source (or GitHub repo/homepage) to ensure code matches the docs; don't embed secret keys in client-bundled public env values — prefer a server-side proxy or keep keys in server-only envs; review network endpoints the package calls; and only install if you trust the package owner and the API endpoint. If you want higher assurance, ask the publisher for a repository/homepage and audit the package contents.
能力评估
Purpose & Capability
The name/description match the instructions: the document describes installing an @ainative/vue-sdk and using its Vue 3 composables (useChat, useCredits, provideAINative). That purpose is consistent with the content. However, the examples clearly expect an AINative API key (import.meta.env.VITE_AINATIVE_API_KEY / runtimeConfig public values) even though the skill metadata declares no required environment variables or primary credential.
Instruction Scope
The SKILL.md stays within scope: it shows npm install, import and usage examples, and references api.ainative.studio as the API endpoint. It does not instruct reading arbitrary system files or unrelated credentials. Minor scope issue: it directs the developer to place an API key in client-side env examples (VITE_ / public runtimeConfig) which has security implications and is not declared in the skill metadata.
Install Mechanism
There is no install spec in the skill bundle (instruction-only). The README recommends 'npm install @ainative/vue-sdk', which is a standard, low-risk package install path. No downloads from arbitrary URLs or archive extraction are present in the skill metadata.
Credentials
The SKILL.md demonstrates use of an AINative API key (VITE_AINATIVE_API_KEY / runtimeConfig.public.ainativeApiKey) to call https://api.ainative.studio, but the skill metadata lists no required environment variables or primary credential. The SDK legitimately needs an API key to function — the metadata omission is an inconsistency and a practical concern. There are no other unrelated credentials requested.
Persistence & Privilege
Flags show always: false and no special privileges. The skill is instruction-only and does not request persistent presence or system-wide configuration changes.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ainative-vue-sdk - 安装完成后,直接呼叫该 Skill 的名称或使用
/ainative-vue-sdk触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of ainative-vue-sdk.
- Adds Vue 3 composables for integrating AINative chat completions in Vue apps.
- Provides useChat and useCredits composables for chat functionality and credit balance.
- Includes provideAINative helper for configuration injection.
- Features complete setup instructions, usage examples, and Nuxt integration guidance.
- Type definitions and primary API surface exported for use in Vue projects.
元数据
常见问题
Ainative Vue Sdk 是什么?
Use @ainative/vue-sdk to add AI chat to Vue 3 apps. Use when (1) Installing @ainative/vue-sdk, (2) Using the useChat composable in Vue components, (3) Provid... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 114 次。
如何安装 Ainative Vue Sdk?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ainative-vue-sdk」即可一键安装,无需额外配置。
Ainative Vue Sdk 是免费的吗?
是的,Ainative Vue Sdk 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Ainative Vue Sdk 支持哪些平台?
Ainative Vue Sdk 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Ainative Vue Sdk?
由 Toby Morning(@urbantech)开发并维护,当前版本 v1.0.0。
推荐 Skills