shapes-sdk-ts
v1.0.9
Published
Light weight SDK for Shapes API
Readme
Shapes SDK
A lightweight TypeScript SDK for the Shapes Inc API supporting both API keys and Auth tokens with dynamic model selection.
Installation
npm install shapes-sdk-tsQuick Start
const { createShapesSDK } = require('shapes-sdk-ts');
const sdk = createShapesSDK({ apiKey: 'your_api_key' });
// Send messages
await sdk.sendMessage("Hello!");
// Analyze audio (MP3, WAV, OGG, M4A)
await sdk.analyzeAudio("./audio.mp3", "Transcribe this");
// Analyze images
await sdk.analyzeImage("./image.jpg", "What's in this image?");Using Auth + APP ID
// API Key
const sdk = createShapesSDK({ apiKey: 'your_api_key' });
// App ID + Auth Token
const sdk = createShapesSDK({
appId: 'your_app_id',
authToken: 'your_auth_token'
});Model Selection
// Method parameter
await sdk.sendMessage("Hello", "shapesinc/bidya");
// Dynamic model proxy
await sdk.sendMessage.model["shapesinc/tenshi"]("Hello");Support debug
const client = createShapesClient({
apiKey: "<API KEY>",
baseUrl: "https://api.shapes.inc/v1",
debug: { enabled: false }, // Enable debugging (true)
});
Shapes Profile
const sdk = createShapesSDK();
try {
console.log('Fetching profile...');
const profile = await sdk.getProfile('testuser'); // Replace with a valid username
console.log('Profile data:', JSON.stringify(profile, null, 2));
} catch (error) {
console.error('Error:', error instanceof Error ? error.message : String(error));
}
Features
- 🤖 Text chat with AI models
- 🎵 Audio transcription & analysis
- 🖼️ Image analysis & description
- 🔧 Flexible authentication options
- 📦 Full TypeScript support
- 🎯 Dynamic model switching
TypeScript
import { createShapesSDK, SDKOptions } from 'shapes-sdk-ts';
const options: SDKOptions = { apiKey: 'your_key' };
const sdk = createShapesSDK(options);