{"_id":"@agoai/vp-sdk","name":"@agoai/vp-sdk","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@agoai/vp-sdk","version":"0.0.2","description":"Official Node.js SDK for the Vp API","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build","test":"jest","lint":"biome lint --write src tests","format":"biome format --write src tests","check":"biome check src tests"},"repository":{"type":"git","url":"git+https://github.com/ageofai-llc/vp-sdk.git"},"bugs":{"url":"https://github.com/ageofai-llc/vp-sdk/issues"},"homepage":"https://github.com/ageofai-llc/vp-sdk#readme","keywords":["vp-sdk","api","sdk","tts","stt","voice","ai","speech","text-to-speech","speech-to-text"],"author":{"name":"Age Of AI"},"license":"ISC","dependencies":{"axios":"^1.11.0"},"devDependencies":{"@biomejs/biome":"2.0.6","@types/jest":"^30.0.0","@types/node":"^20.14.2","axios-mock-adapter":"^2.1.0","jest":"^30.0.3","jest-fetch-mock":"^3.0.3","ts-jest":"^29.4.0","typescript":"^5.4.5"},"_id":"@agoai/vp-sdk@0.0.2","gitHead":"9a98883cdbbe69b5ec8abb98699bb0dbf5bc5304","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-dGt5X8j2mydnAHMaiTqW/14hcLw9J00NPvSJbL4DS7qLx+1vOcolZRu76tjzTtcFRt7Er96rK0rSs7doZdcjxg==","shasum":"3295e4470d4d5c6435abb890ddbc11a843748ebf","tarball":"https://registry.npmjs.org/@agoai/vp-sdk/-/vp-sdk-0.0.2.tgz","fileCount":135,"unpackedSize":205595,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDrTqmDNN4dDRf2WtuuaEAmh4StQlS08PYfK6LeDiUxIgIgGpxDRKeMDaELBsifdo2WatLs0rrasewHDhwoSlm3ph0="}]},"_npmUser":{"name":"rockyxcoded","email":"rockyxcoded@gmail.com"},"directories":{},"maintainers":[{"name":"melexdev","email":"melexchi@gmail.com"},{"name":"incenix","email":"davidayoa11@gmail.com"},{"name":"rockyxcoded","email":"rockyxcoded@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vp-sdk_0.0.2_1756850264854_0.11831402796864343"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-02T21:57:44.754Z","0.0.2":"2025-09-02T21:57:45.052Z","modified":"2025-09-02T21:57:45.373Z"},"maintainers":[{"name":"melexdev","email":"melexchi@gmail.com"},{"name":"incenix","email":"davidayoa11@gmail.com"},{"name":"rockyxcoded","email":"rockyxcoded@gmail.com"}],"description":"Official Node.js SDK for the Vp API","homepage":"https://github.com/ageofai-llc/vp-sdk#readme","keywords":["vp-sdk","api","sdk","tts","stt","voice","ai","speech","text-to-speech","speech-to-text"],"repository":{"type":"git","url":"git+https://github.com/ageofai-llc/vp-sdk.git"},"author":{"name":"Age Of AI"},"bugs":{"url":"https://github.com/ageofai-llc/vp-sdk/issues"},"license":"ISC","readme":"# vp-sdk\n\n[![npm version](https://img.shields.io/npm/v/@ageofai/vp-sdk)](https://www.npmjs.com/package/@ageofai/vp-sdk)\n[![License](https://img.shields.io/badge/license-Proprietary-blue)](LICENSE)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen)]()\n[![TypeScript](https://img.shields.io/badge/typescript-supported-blue)]()\n\nThe official Node.js SDK for the Scoreexl API—a secure audio AI platform providing Speech-to-Text (STT), Text-to-Speech (TTS) with Google Chirp3 HD & Deepgram Aura-2, RAG-based knowledge, analytics, credits, and notifications.\n\n## Features\n\n- Complete API Coverage  \n- TypeScript Support  \n- Authentication Management  \n- Error Handling  \n- Modular Architecture  \n- File Upload Support  \n- Retry Logic  \n- Pagination Support  \n\n## Installation\n\n```bash\n# npm\nnpm install @ageofai/vp-sdk\n\n# yarn\nyarn add @ageofai/vp-sdk\n```\n\n## Quick Start\n\n```javascript\nconst { VpSdk } = require('@ageofai/vp-sdk');\n(async () => {\n  const client = new VpSdk({ apiKey: 'YOUR_API_KEY' });\n  try {\n    // Register & log in\n    const user = await client.auth.register({ email: 'user@example.com', password: 'StrongP@ssw0rd' });\n    await client.auth.login({ email: user.email, password: 'StrongP@ssw0rd' });\n\n    // List voices & synthesize text\n    const voices = await client.tts.listVoices();\n    const synth = await client.tts.synthesize({\n      text: 'Hello, Scoreexl!',\n      voiceId: voices[0].id\n    });\n    console.log('Synthesis started:', synth);\n  } catch (error) {\n    console.error('Quick start error:', error);\n  }\n})();\n```\n\n## API Reference\n\n### Authentication\n- **register(userData)**  \n  Register a new user.  \n  ```javascript\n  const user = await client.auth.register({ email, password });\n  ```\n- **login(credentials)**  \n  Log in and store tokens.  \n  ```javascript\n  await client.auth.login({ email, password });\n  ```\n- **logout()**  \n  Log out and clear tokens.  \n  ```javascript\n  await client.auth.logout();\n  ```\n\n### Users\n- **getUser(userId)**  \n  Fetch user details by ID.  \n  ```javascript\n  const user = await client.users.getUser(userId);\n  ```\n- **updateUser(userId, data)**  \n  Update user profile.  \n  ```javascript\n  await client.users.updateUser(userId, updateData);\n  ```\n- **deleteUser(userId)**  \n  Remove a user account.  \n  ```javascript\n  await client.users.deleteUser(userId);\n  ```\n\n### Text-to-Speech (TTS)\n- **listVoices()**  \n  Get available voices.  \n  ```javascript\n  const voices = await client.tts.listVoices();\n  ```\n- **synthesize(options)**  \n  Start a synthesis job.  \n  ```javascript\n  const { synthesisId } = await client.tts.synthesize({ text, voiceId });\n  ```\n- **getSynthesisStatus(synthesisId)**  \n  Check synthesis status.  \n  ```javascript\n  const status = await client.tts.getSynthesisStatus(synthesisId);\n  ```\n- **downloadAudio(synthesisId)**  \n  Download completed audio.  \n  ```javascript\n  const stream = await client.tts.downloadAudio(synthesisId);\n  ```\n\n### Speech-to-Text (STT)\n- **transcribe(options)**  \n  Submit an audio file for transcription.  \n  ```javascript\n  const { transcriptionId } = await client.stt.transcribe({ file: fsStream });\n  ```\n- **getTranscriptionStatus(transcriptionId)**  \n  Check transcription status.  \n  ```javascript\n  const result = await client.stt.getTranscriptionStatus(transcriptionId);\n  ```\n\n### Credits\n- **getCredits()**  \n  Retrieve current credit balance.  \n  ```javascript\n  const credits = await client.credits.getCredits();\n  ```\n- **purchaseCredits(amount)**  \n  Purchase additional credits.  \n  ```javascript\n  await client.credits.purchaseCredits(amount);\n  ```\n\n### Analytics\n- **getUsageStats(params)**  \n  Fetch usage analytics.  \n  ```javascript\n  const stats = await client.analytics.getUsageStats({ from, to });\n  ```\n\n### Notifications\n- **listNotifications()**  \n  Retrieve user notifications.  \n  ```javascript\n  const list = await client.notifications.listNotifications();\n  ```\n- **markAsRead(notificationId)**  \n  Mark a notification as read.  \n  ```javascript\n  await client.notifications.markAsRead(notificationId);\n  ```\n\n### RAG\n- **createSession(context)**  \n  Start a RAG session with context.  \n  ```javascript\n  const { sessionId } = await client.rag.createSession({ documents });\n  ```\n- **query(sessionId, query)**  \n  Query the RAG session.  \n  ```javascript\n  const response = await client.rag.query(sessionId, 'Your question');\n  ```\n\n### API Keys\n- **listKeys()**  \n  List all API keys.  \n  ```javascript\n  const keys = await client.apiKeys.listKeys();\n  ```\n- **createKey(params)**  \n  Generate a new API key.  \n  ```javascript\n  const key = await client.apiKeys.createKey({ name });\n  ```\n- **revokeKey(keyId)**  \n  Revoke an existing key.  \n  ```javascript\n  await client.apiKeys.revokeKey(keyId);\n  ```\n\n### Agents\n- **listAgents()**  \n  Fetch available agents.  \n  ```javascript\n  const agents = await client.agents.listAgents();\n  ```\n- **runAgent(agentId, input)**  \n  Execute an agent with input.  \n  ```javascript\n  const result = await client.agents.runAgent(agentId, { prompt });\n  ```\n\n### Usage Tracking\n- **trackEvent(eventData)**  \n  Record a custom event.  \n  ```javascript\n  await client.usage.trackEvent({ event, metadata });\n  ```\n- **getEvents(params)**  \n  Retrieve tracked events.  \n  ```javascript\n  const events = await client.usage.getEvents({ limit, offset });\n  ```\n\n## Error Handling\n\nAll SDK errors extend a base `ScoreexlError` and include:\n- **message**: human-readable error  \n- **statusCode**: HTTP status  \n- **code**: machine error code  \n- **details**: additional metadata  \n\n```javascript\nconst {\n  AuthenticationError,\n  RateLimitError,\n  TranscriptionError,\n  SynthesisError\n} = require('@ageofai/vp-sdk').errors;\n\ntry {\n  await client.auth.login({ email, password });\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    console.error('Auth failed:', error.message, error.statusCode, error.code);\n  } else if (error instanceof RateLimitError) {\n    console.error('Too many requests:', error.details);\n  } else {\n    console.error('Unexpected error:', error);\n  }\n}\n```\n\n## Advanced Configuration\n\n### Custom Axios Configuration\n```javascript\nconst client = new VpSdk({\n  apiKey: 'KEY',\n  axiosConfig: { baseURL: 'https://api.scoreexl.com', timeout: 10000 }\n});\n```\n\n### Manual Token Management\n```javascript\nclient.setAccessToken('ACCESS_TOKEN');\nclient.setRefreshToken('REFRESH_TOKEN');\n```\n\n### File Uploads\nNode.js:\n```javascript\nconst fs = require('fs');\nawait client.stt.transcribe({ file: fs.createReadStream('audio.wav') });\n```\nBrowser:\n```javascript\nawait client.stt.transcribe({ file: new File([blob], 'audio.wav') });\n```\n\n## TypeScript Support\n\nFull type definitions are included.\n\n```typescript\nimport { VpSdk, AuthClient } from '@ageofai/vp-sdk';\nconst client: VpSdk = new VpSdk({ apiKey: 'KEY' });\n```\n\n## Examples\n\n### Complete TTS Workflow\n\n```javascript\nconst fs = require('fs');\n(async () => {\n  const client = new VpSdk({ apiKey: 'YOUR_API_KEY' });\n  await client.auth.login({ email: 'user@example.com', password: 'StrongP@ssw0rd' });\n\n  const voices = await client.tts.listVoices();\n  const { synthesisId } = await client.tts.synthesize({\n    text: 'Hello, Scoreexl!',\n    voiceId: voices[0].id\n  });\n\n  let status;\n  do {\n    await new Promise(r => setTimeout(r, 2000));\n    status = await client.tts.getSynthesisStatus(synthesisId);\n  } while (status.state !== 'completed');\n\n  const audioStream = await client.tts.downloadAudio(synthesisId);\n  const writeStream = fs.createWriteStream('output.mp3');\n  audioStream.pipe(writeStream);\n  console.log('Audio saved to output.mp3');\n})();\n```\n\n### STT Transcription with Error Handling\n\n```javascript\nconst fs = require('fs');\nconst { TranscriptionError } = require('@ageofai/vp-sdk').errors;\n\n(async () => {\n  const client = new VpSdk({ apiKey: 'YOUR_API_KEY' });\n  try {\n    await client.auth.login({ email: 'user@example.com', password: 'StrongP@ssw0rd' });\n    const fileStream = fs.createReadStream('input.wav');\n    const { transcriptionId } = await client.stt.transcribe({ file: fileStream });\n\n    let result;\n    do {\n      await new Promise(r => setTimeout(r, 2000));\n      result = await client.stt.getTranscriptionStatus(transcriptionId);\n    } while (result.state !== 'completed');\n\n    console.log('Transcribed text:', result.text);\n    console.table(result.segments);\n  } catch (error) {\n    if (error instanceof TranscriptionError) {\n      console.error('Transcription failed:', error.details);\n    } else {\n      throw error;\n    }\n  }\n})();\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## Support\n\nOpen an issue in this repository\n\n<!-- ## License\n\nProprietary. See [LICENSE](LICENSE).\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for release notes.\n\n## API Version Compatibility\n\nCompatible with Scoreexl API **v2.0.0+**.\n\n## Browser Support\n\nWorks in Node.js and modern browsers.\n\n## Security\n\nReport vulnerabilities to security@ageofai.com. -->\n","readmeFilename":"README.md","_rev":"1-625d0553d49397a6c95edf656699919b"}