Execute Tool
Execute a specific tool by passing encrypted parameters.
TypeScript SDK
The SDK is available on GitHub: premAI-io/api-sdk-tsUsage
Basic Setup
Create a client with auto-generated encryption keys:Pre-generate Keys
You can pre-generate encryption keys and reuse them:Features
- ✅ File-Producing Tools - Generate images, audio, and custom files
- ✅ File-Processing Tools - Extract content from PDFs, images, audio, video, and other file types
- ✅ Simple Tools - Web search, time, web scraping
- ✅ RAG Tools - Search indexed documents with an optional file filter
- ✅ End-to-end Encryption - All tool calls use end-to-end encryption
- ✅ Automatic Decryption - The SDK automatically downloads and decrypts files
- ✅ TypeScript - Full type safety
Tools
All tool calls use end-to-end encryption. The SDK automatically downloads and decrypts files.File-Producing Tools
Generate files with these tools. The SDK automatically decrypts the files and returns them:File-Processing Tools
Process uploaded files and get the results:Simple Tools
These tools do not process files:Available Tools
File-Producing Tools
generateImage(params: { prompt: string })- Generate images from textaudioGenerateFromText(params: { text: string })- Text-to-speechcreateFileForUser(params: { fileName: string, fileExtension: string, fileContent: string, mimeType: string })- Create custom files
File-Processing Tools
imageDescribeAndCaption(params: { fileId: string })- Describe imagesimageDescribeAndCaptionFallback(params: { fileId: string })- Alternative image descriptionvideoDescribeAndCaption(params: { fileId: string })- Describe videosgetPDFContent(params: { fileId: string })- Extract PDF textgetTextDocumentContent(params: { fileId: string })- Extract document texttranscribeAudioToText(params: { fileId: string, language?: string })- Audio transcriptiontranscribeAudioWithDiarization(params: { fileId: string, language?: string })- Transcription with speakersaudioDiarization(params: { fileId: string })- Identify speakersgetFileContentOCR(params: { fileId: string })- OCR on imagesgetSpreadsheetContent(params: { fileId: string })- Extract spreadsheet datagetDataFileContent(params: { fileId: string })- Extract data file contentgetPowerPointContent(params: { fileId: string, slideNumbers?: number[] })- Extract presentation content
Simple Tools
getTime(params: { timezone: string })- Get current timewebSearchTool(params: { query: string, country?: string, searchLang?: string })- Web searchwebPageScraperTool(params: { url: string, renderJs?: boolean })- Scrape web pages
RAG Tools
searchRag(params: { query: string })- Search indexed documents with an optional file filter
Configuration Options
Security Notes
- ⚠️ Keep your DEK store secure. The DEK store contains all of your encryption keys.
- ⚠️ Do not commit
dek-store.jsonto version control. - ⚠️ Use environment variables for API keys.
- ⚠️ Save the dekStore after each file upload. The dekStore holds the DEKs for your files.
- ⚠️ Make a backup of your dekStore. If you lose it, you lose access to your uploaded files.
TypeScript Types
Authorizations
Send your access token as header Authorization: Bearer {accessToken}
Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.
Path Parameters
The tool identifier (e.g., generateImage, audioGenerateFromText, createFileForUser)
Body
- Simple Tool Request
- File Output Tool Request
- File Input Tool Request
- RAG Tool Request
Request for simple tools that don't involve file I/O: webSearchTool, getTime, webPageScraperTool
Response
Tool executed successfully with encrypted response
Status code of the response
200, 201, 202 Response for file-producing tools (generateImage, audioGenerateFromText, createFileForUser)
- File Output Response
- Encrypted Response
Message of the response, human readable
"Resource created successfully"
API environment
development, production Error message of the response, human readable
"Invalid email address"
Useful informaiton, not always present, to debug the response
"Some pertinent log message"
Validator response object, each key is the field name and value is the error message
Support ID linked to the response, used to identify it when talking with our team
"support_uuidv7-something-else"