Coding & Developmentβ¨geminiπ€claudeπ¬gptπuniversal
Qiniu AI SDK
TypeScript SDK for Qiniu Cloud AI Token API
Quick Start
Install this Skill
npx skills add bowenQT/qiniu-ai-sdk# Qiniu AI SDK
<div align="center">
[](https://www.npmjs.com/package/@bowenqt/qiniu-ai-sdk)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
**TypeScript SDK for Qiniu Cloud AI Services**
[English](./README.md) | [δΈζ](./README.zh-CN.md) | [COOKBOOK](./COOKBOOK.md)
</div>
---
## β¨ Features
### Core AI Modules
- π **Chat Completions** β OpenAI-compatible interface with streaming support
- πΌοΈ **Image Generation** β Kling, Gemini models with unified sync/async API
- π₯ **Video Generation** β Kling, Sora, Veo models with first/last frame control
- π **Web Search** β Real-time web search integration
- π **OCR** β High-precision text recognition for images and PDFs
- π€ **ASR** β Multi-language speech recognition (95%+ accuracy in noisy environments)
- π **TTS** β Text-to-speech synthesis with multiple voice options
- π‘οΈ **Content Moderation** β Image and video censorship with scene-based detection
### Agentic Layer
- π€ **generateText** β Multi-step tool execution with Zod schema support
- π **generateObject/streamObject** β Structured JSON output with streaming
- π§ **AgentGraph** β State machine-based graph execution
- π **createAgent** β Reusable agent factory with configurable behaviors
### Advanced Capabilities
- π **Skills Injection** β Markdown-based agent knowledge (Claude Skills compatible)
- π **MCP Client** β Model Context Protocol with stdio + HTTP + OAuth 2.0 support
- π₯οΈ **MCP Server** β Built-in Qiniu MCP server for OCR/Censor/Vframe tools
- πΎ **Checkpointer** β State persistence (Memory, Redis, PostgreSQL, Kodo)
- π§ **Memory Manager** β Short-term + long-term memory with LLM summarization
- β
**Tool Approval (HITL)** β Human-in-the-loop for sensitive operations
- βΈοΈ **Interrupt/Resume** β Resumable execution with checkpoint-based restore
- π **OpenTelemetry Tracing** β Distributed tracing with per-node spans
- π **Vercel AI SDK Adapter** β Drop-in replacement for Vercel AI SDK
---
## π¦ Installation
```bash
npm install @bowenqt/qiniu-ai-sdk
```
### Optional Peer Dependencies
```bash
# For Vercel AI SDK integration
npm install @ai-sdk/provider ai
# For Zod schema validation
npm install zod
# For Redis checkpointer
npm install ioredis
# For PostgreSQL checkpointer
npm install pg
```
---
## π Quick Start
```typescript
import { QiniuAI } from '@bowenqt/qiniu-ai-sdk';
const client = new QiniuAI({
apiKey: 'Sk-xxxxxxxxxxxxxxxx',
});
// Chat completion
const chat = await client.chat.create({
model: 'gemini-2.5-flash',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(chat.choices[0].message.content);
// Streaming chat
const stream = await client.chat.createStream({
model: 'gemini-2.5-flash',
messages: [{ role: 'user', content: 'Explain AI briefly' }],
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
```
---
## π€ Agentic Usage
### Tool Execution with generateText
```typescript
import { QiniuAI, generateText } from '@bowenqt/qiniu-ai-sdk';
import { z } from 'zod';
const client = new QiniuAI({ apiKey: process.env.QINIU_API_KEY || '' });
const result = await generateText({
client,
model: 'gemini-2.5-flash',
prompt: 'What is 42 * 17?',
tools: {
calculate: {
description: 'Perform calculation',
parameters: z.object({
operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
a: z.number(),
b: z.number(),
}),
execute: async ({ operation, a, b }) => {
const ops = { add: a + b, subtract: a - b, multiply: a * b, divide: a / b };
return ops[operation];
},
},
},
maxSteps: 3,
});
console.log(result.text); // Final answer
console.log(result.toolCalls); // Tool calls made
```
### Structured Output
```typescript
import { generateObject } from '@bowenqt/qiniu-ai-sdk';
import { z } from 'zod';
const result = await generateObject({
client,
model: 'gemini-2.5-flash',
prompt: 'Generate a product listing',
schema: z.object({
name: z.string(),
price: z.number(),
category: z.string(),
}),
});
console.log(result.object); // Typed object
```
---
## πΌοΈ Image & Video Generation
```typescript
// Image generation (async task)
const imageResult = await client.image.generate({
model: 'kling-v2',
prompt: 'A futuristic city at sunset',
});
const finalImage = await client.image.waitForResult(imageResult);
console.log(finalImage.data?.[0].url);
// Video generation with first/last frame
const videoTask = await client.video.create({
model: 'kling-video-o1',
prompt: 'A cat jumps from one ledge to another',
frames: {
first: { url: 'https://example.com/start.jpg' },
last: { url: 'https://example.c
... (truncated)Repository
3stars
0forks
Details
Related Skills
More coding & development skills you might like
Reticle
Coding & DevelopmentAI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.
π€claudeπuniversal
1.2k
190
View
agentscope-java
Coding & DevelopmentExpert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
πuniversal
6.0k
1.5k
View
ospec
Coding & DevelopmentDocument-driven OSpec workflow for initialization, change/goal routing, validation, archiving, and durable project knowledge.
β¨geminiπ€claudeπ¬gptπuniversal
524
34
View
misakanet-failure-memory
Coding & Developmentπ A zero-dependency, git-backed micro-lesson library for AI Agents to asynchronously share and search verified debugging experience. Python stdlib only. | https://misakanet.org
π€claudeβ¨οΈcursorπuniversal
424
158
View