
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
p4u-client-ai
Advanced tools
Empower Your Apps with AI: Access Multiple Models, Automate Tasks, Create AI Agents Easily
Empower Your Apps with AI: Access Multiple Models, Automate Tasks, Create AI Agents Easily
yarn add p4u-client-ai
# or
npm install p4u-client-ai
import AIClient, { GPTModelsEnum, IRequest, IInsert } from 'p4u-client-ai';
const client = new AIClient();
// Login
await client.login('your-username', 'your-password');
// List available tasks
const tasks = await client.listTasks();
// Run a task
const request: IRequest = {
ask: 'What is the weather today?',
context: 'Weather inquiry',
idTask: 'task-id'
};
const result = await client.runTask(request);
// Create a new task
const newTask: IInsert = {
name: 'Weather Assistant',
context: 'Provides weather information',
model: GPTModelsEnum.OAIGPT4o,
instruction: 'You are a helpful weather assistant'
};
await client.createTask(newTask);
You can import all types and enums directly from the package root:
import AIClient, {
IRequest,
IInsert,
IDelete,
GPTModelsEnum,
AudioModelsEnum,
ImageModelsEnum,
VideoModelsEnum,
} from 'p4u-client-ai';
GPTModelsEnum.OAIGPT5 - GPT-5GPTModelsEnum.OAIGPT5mini - GPT-5 miniGPTModelsEnum.OAIGPT5nano - GPT-5 nanoGPTModelsEnum.OAIGPT41 - GPT-4.1 (2025-04-14)GPTModelsEnum.OAIGPT41mini - GPT-4.1 mini (2025-04-14)GPTModelsEnum.OAIGPT41nano - GPT-4.1 nano (2025-04-14)GPTModelsEnum.OAIGPT4o - GPT-4o (2024-11-20)GPTModelsEnum.OAIGPT4omini - GPT-4o MiniGPTModelsEnum.OAIGPTo1Preview - o1-previewGPTModelsEnum.OAIGPTo1Mini - o1-miniGPTModelsEnum.OAIGPTo3Mini - o3-mini (2025-01-31)GPTModelsEnum.Claude4Sonet - Claude Sonnet 4 (2025-05-14)GPTModelsEnum.Claude3Haiku - Claude 3 Haiku (2024-03-07)GPTModelsEnum.Claude35Haiku - Claude 3.5 Haiku (2024-10-22)AudioModelsEnum.OAIWHISPER1 - Whisper-1AudioModelsEnum.OAITTS1 - TTS-1AudioModelsEnum.OAITTS1HD - TTS-1 HDAudioModelsEnum.OAITTS4oMINI - GPT-4o Mini TTSAudioModelsEnum.OAI4oMiniTranscribe - GPT-4o Mini TranscribeImageModelsEnum.SDV3 - Stable Diffusion v3ImageModelsEnum.SDV3_CORE - Stable Diffusion v3 CoreImageModelsEnum.SDV3_ULTRA - Stable Diffusion v3 UltraImageModelsEnum.SDV3_TURBO_LARGE - Stable Diffusion v3 Turbo LargeImageModelsEnum.SDV3_LARGE - Stable Diffusion v3 LargeImageModelsEnum.SDV3_MEDIUM - Stable Diffusion v3 MediumImageModelsEnum.SDV1_6 - Stable Diffusion v1.6ImageModelsEnum.SDV1XL - Stable Diffusion XL 1024 v1.0ImageModelsEnum.SDV2XLBeta - Stable Diffusion XL Beta v2.2.2ImageModelsEnum.SDV1_VIDEO - Stable Diffusion v1 VideoVideoModelsEnum.VSDV2Beta - Stable Diffusion Video v2 Betalogin(userName: string, password: string) - Authenticate with the APIpingPong() - Test API connectivitylistTasks() - Get all available tasksrunTask(request: IRequest) - Execute a taskcreateTask(request: IInsert) - Create a new taskdeleteTask(request: IDelete) - Delete a tasksetLocalUrl(url: string) - Set custom API URL for developmentlistAgents() - Get all agentsgetAgent(id: string) - Get one agentcreateAgent(request: IInsertAgent) - Create agentupdateAgent(request: IUpdateAgent) - Update agentdeleteAgent(id: string) - Delete agentqueryAgent(body: IAgentQueryRequest) - Run a query through an agent (stream or text response per backend)Usage:
import AIClient, { GPTModelsEnum } from 'p4u-client-ai';
const client = new AIClient();
await client.login('user','pass');
const created = await client.createAgent({
name: 'My Agent',
model: GPTModelsEnum.OAIGPT4o,
instruction: 'You are helpful.'
});
const agents = await client.listAgents();
const answer = await client.queryAgent({ idAgent: created.data.id, ask: 'Hello!' });
getAllAgentRag(query?: Record<string, any>) - List RAG entriesgetAgentRag(id: string) - Get RAG entrycreateAgentRag(data: IAgentRag) - Create RAG entry (multipart form)deleteAgentRag(id: string) - Delete RAG entryaddKnowledge(data: IAddKnowledgeRequest) - Add knowledge contentaddKnowledgeBatch(data: IAddKnowledgeBatchRequest) - Add knowledge in batchaddKnowledgeFromFile(agentRagId: string, file: Blob, metadata?: Record<string, any>) - Upload file knowledgesearchKnowledge(data: ISearchKnowledgeRequest) - Semantic searchgetKnowledgeById(id: string) - Get one knowledge itemgetKnowledgeStatistics(agentRagId: string) - StatsgetKnowledgeByAgentRagId(agentRagId: string) - List knowledge items for RAGexcludeKnowledge(data: IExcludeKnowledgeRequest) - Remove specific chunkssearchKnowledgeByMetadata(data: ISearchKnowledgeByMetadataRequest) - Filter by metadataUsage:
import AIClient from 'p4u-client-ai';
const client = new AIClient();
await client.login('user','pass');
// Create RAG entry without file
const rag = await client.createAgentRag({
name: 'Docs KB',
agentId: 'agent-id',
description: 'Product docs'
});
// Upload a file to knowledge base
const file = new Blob([new Uint8Array([1,2,3])], { type: 'application/pdf' });
await client.addKnowledgeFromFile(rag.data.id, file, { section: 'intro' });
// Search knowledge
const search = await client.searchKnowledge({ agentRagId: rag.data.id, query: 'pricing', limit: 5 });
This package includes full TypeScript definitions with interfaces:
IRequest - For task execution requestsIInsert - For creating new tasksIDelete - For deleting tasksApache-2.0
FAQs
Empower Your Apps with AI: Access Multiple Models, Automate Tasks, Create AI Agents Easily
The npm package p4u-client-ai receives a total of 0 weekly downloads. As such, p4u-client-ai popularity was classified as not popular.
We found that p4u-client-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.