import { Sudo } from "sudo-ai";const sudo = new Sudo({ serverURL: "https://sudoapp.dev/api", apiKey: process.env.SUDO_API_KEY ?? "",});async function deleteCompletion(completionId: string) { try { const result = await sudo.router.deleteChatCompletion(completionId); return result; } catch (error) { console.error("Delete completion error:", error); return null; }}// Delete a completionasync function deleteCompletionExample() { const result = await deleteCompletion("chatcmpl-abc123"); if (result) { console.log(`Deletion result: ${JSON.stringify(result)}`); }}deleteCompletionExample();
CRUD operations are only available for completions created with store=True. This feature is designed for OpenAI API compatibility and works with both Python and TypeScript SDKs.
The Sudo SDK provides comprehensive functionality for building AI-powered applications in both Python and TypeScript:
System Endpoints: Monitor API health and discover available models
Chat Completion: Generate responses from various AI models with extensive customization
Streaming: Real-time response generation for interactive applications
Tool Calling: Enable AI models to execute functions and interact with external systems
Structured Output: Generate validated JSON responses for reliable data extraction
Image Input: Process images and multimodal content with vision-capable models
Reasoning: Access advanced reasoning capabilities for complex problem-solving
CRUD Operations: Manage stored completions for analysis and improvement
Both SDKs are designed for production use with comprehensive error handling, async support, and best practices built-in. Start with basic chat completions and gradually add advanced features as needed.Resources: