[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75CZP58WCST5Z9JTX5KXWMC":3,"skill-same:01M75CZP58WCST5Z9JTX5KXWMC":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":13,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M75CZP58WCST5Z9JTX5KXWMC","ASR",null,"Implement speech-to-text (ASR\u002Fautomatic speech recognition) capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to transcribe audio files, convert speech to text, build voice input features, or process audio recordings. Supports base64 encoded audio files and returns accurate text transcriptions.","nordeim\u002Fonestopnews","nordeim","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F194583642?v=4","01M75CZEV8C3V4DDQNPQ1EA7QJ","01M75CZEWBH4NQBG9THF3SKTRE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002FASR\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002FASR\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: ASR\ndescription: Implement speech-to-text (ASR\u002Fautomatic speech recognition) capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to transcribe audio files, convert speech to text, build voice input features, or process audio recordings. Supports base64 encoded audio files and returns accurate text transcriptions.\nlicense: MIT\n---\n\n# ASR (Speech to Text) Skill\n\nThis skill guides the implementation of speech-to-text (ASR) functionality using the z-ai-web-dev-sdk package, enabling accurate transcription of spoken audio into text.\n\n## Skills Path\n\n**Skill Location**: `{project_path}\u002Fskills\u002FASR`\n\nthis skill is located at above path in your project.\n\n**Reference Scripts**: Example test scripts are available in the `{Skill Location}\u002Fscripts\u002F` directory for quick testing and reference. See `{Skill Location}\u002Fscripts\u002Fasr.ts` for a working example.\n\n## Overview\n\nSpeech-to-Text (ASR - Automatic Speech Recognition) allows you to build applications that convert spoken language in audio files into written text, enabling voice-controlled interfaces, transcription services, and audio content analysis.\n\n**IMPORTANT**: z-ai-web-dev-sdk MUST be used in backend code only. Never use it in client-side code.\n\n## Prerequisites\n\nThe z-ai-web-dev-sdk package is already installed. Import it as shown in the examples below.\n\n## CLI Usage (For Simple Tasks)\n\nFor simple audio transcription tasks, you can use the z-ai CLI instead of writing code. This is ideal for quick transcriptions, testing audio files, or batch processing.\n\n### Basic Transcription from File\n\n```bash\n# Transcribe an audio file\nz-ai asr --file .\u002Faudio.wav\n\n# Save transcription to JSON file\nz-ai asr -f .\u002Frecording.mp3 -o transcript.json\n\n# Transcribe and view output\nz-ai asr --file .\u002Finterview.wav --output result.json\n```\n\n### Transcription from Base64\n\n```bash\n# Transcribe from base64 encoded audio\nz-ai asr --base64 \"UklGRiQAAABXQVZFZm10...\" -o result.json\n\n# Using short option\nz-ai asr -b \"base64_encoded_audio_data\" -o transcript.json\n```\n\n### Streaming Output\n\n```bash\n# Stream transcription results\nz-ai asr -f .\u002Faudio.wav --stream\n```\n\n### CLI Parameters\n\n- `--file, -f \u003Cpath>`: **Required** (if not using --base64) - Audio file path\n- `--base64, -b \u003Cbase64>`: **Required** (if not using --file) - Base64 encoded audio\n- `--output, -o \u003Cpath>`: Optional - Output file path (JSON format)\n- `--stream`: Optional - Stream the transcription output\n\n### Supported Audio Formats\n\nThe ASR service supports various audio formats including:\n- WAV (.wav)\n- MP3 (.mp3)\n- Other common audio formats\n\n### When to Use CLI vs SDK\n\n**Use CLI for:**\n- Quick audio file transcriptions\n- Testing audio recognition accuracy\n- Simple batch processing scripts\n- One-off transcription tasks\n\n**Use SDK for:**\n- Real-time audio transcription in applications\n- Integration with recording systems\n- Custom audio processing workflows\n- Production applications with streaming audio\n\n## Basic ASR Implementation\n\n### Simple Audio Transcription\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeAudio(audioFilePath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Read audio file and convert to base64\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return response.text;\n}\n\n\u002F\u002F Usage\nconst transcription = await transcribeAudio('.\u002Faudio.wav');\nconsole.log('Transcription:', transcription);\n```\n\n### Transcribe Multiple Audio Files\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeBatch(audioFilePaths) {\n  const zai = await ZAI.create();\n  const results = [];\n\n  for (const filePath of audioFilePaths) {\n    try {\n      const audioFile = fs.readFileSync(filePath);\n      const base64Audio = audioFile.toString('base64');\n\n      const response = await zai.audio.asr.create({\n        file_base64: base64Audio\n      });\n\n      results.push({\n        file: filePath,\n        success: true,\n        transcription: response.text\n      });\n    } catch (error) {\n      results.push({\n        file: filePath,\n        success: false,\n        error: error.message\n      });\n    }\n  }\n\n  return results;\n}\n\n\u002F\u002F Usage\nconst files = ['.\u002Finterview1.wav', '.\u002Finterview2.wav', '.\u002Finterview3.wav'];\nconst transcriptions = await transcribeBatch(files);\n\ntranscriptions.forEach(result => {\n  if (result.success) {\n    console.log(`${result.file}: ${result.transcription}`);\n  } else {\n    console.error(`${result.file}: Error - ${result.error}`);\n  }\n});\n```\n\n## Advanced Use Cases\n\n### Audio File Processing with Metadata\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\nimport path from 'path';\n\nasync function transcribeWithMetadata(audioFilePath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Get file metadata\n  const stats = fs.statSync(audioFilePath);\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const startTime = Date.now();\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  const endTime = Date.now();\n\n  return {\n    filename: path.basename(audioFilePath),\n    filepath: audioFilePath,\n    fileSize: stats.size,\n    transcription: response.text,\n    wordCount: response.text.split(\u002F\\s+\u002F).length,\n    processingTime: endTime - startTime,\n    timestamp: new Date().toISOString()\n  };\n}\n\n\u002F\u002F Usage\nconst result = await transcribeWithMetadata('.\u002Fmeeting_recording.wav');\nconsole.log('Transcription Details:', JSON.stringify(result, null, 2));\n```\n\n### Real-time Audio Processing Service\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nclass ASRService {\n  constructor() {\n    this.zai = null;\n    this.transcriptionCache = new Map();\n  }\n\n  async initialize() {\n    this.zai = await ZAI.create();\n  }\n\n  generateCacheKey(audioBuffer) {\n    const crypto = require('crypto');\n    return crypto.createHash('md5').update(audioBuffer).digest('hex');\n  }\n\n  async transcribe(audioFilePath, useCache = true) {\n    const audioBuffer = fs.readFileSync(audioFilePath);\n    const cacheKey = this.generateCacheKey(audioBuffer);\n\n    \u002F\u002F Check cache\n    if (useCache && this.transcriptionCache.has(cacheKey)) {\n      return {\n        transcription: this.transcriptionCache.get(cacheKey),\n        cached: true\n      };\n    }\n\n    \u002F\u002F Transcribe audio\n    const base64Audio = audioBuffer.toString('base64');\n\n    const response = await this.zai.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    \u002F\u002F Cache result\n    if (useCache) {\n      this.transcriptionCache.set(cacheKey, response.text);\n    }\n\n    return {\n      transcription: response.text,\n      cached: false\n    };\n  }\n\n  clearCache() {\n    this.transcriptionCache.clear();\n  }\n\n  getCacheSize() {\n    return this.transcriptionCache.size;\n  }\n}\n\n\u002F\u002F Usage\nconst asrService = new ASRService();\nawait asrService.initialize();\n\nconst result1 = await asrService.transcribe('.\u002Faudio.wav');\nconsole.log('First call (not cached):', result1);\n\nconst result2 = await asrService.transcribe('.\u002Faudio.wav');\nconsole.log('Second call (cached):', result2);\n```\n\n### Directory Transcription\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\nimport path from 'path';\n\nasync function transcribeDirectory(directoryPath, outputJsonPath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Get all audio files\n  const files = fs.readdirSync(directoryPath);\n  const audioFiles = files.filter(file => \n    \u002F\\.(wav|mp3|m4a|flac|ogg)$\u002Fi.test(file)\n  );\n\n  const results = {\n    directory: directoryPath,\n    totalFiles: audioFiles.length,\n    processedAt: new Date().toISOString(),\n    transcriptions: []\n  };\n\n  for (const filename of audioFiles) {\n    const filePath = path.join(directoryPath, filename);\n\n    try {\n      const audioFile = fs.readFileSync(filePath);\n      const base64Audio = audioFile.toString('base64');\n\n      const response = await zai.audio.asr.create({\n        file_base64: base64Audio\n      });\n\n      results.transcriptions.push({\n        filename: filename,\n        success: true,\n        text: response.text,\n        wordCount: response.text.split(\u002F\\s+\u002F).length\n      });\n\n      console.log(`✓ Transcribed: ${filename}`);\n    } catch (error) {\n      results.transcriptions.push({\n        filename: filename,\n        success: false,\n        error: error.message\n      });\n\n      console.error(`✗ Failed: ${filename} - ${error.message}`);\n    }\n  }\n\n  \u002F\u002F Save results to JSON\n  fs.writeFileSync(\n    outputJsonPath,\n    JSON.stringify(results, null, 2)\n  );\n\n  return results;\n}\n\n\u002F\u002F Usage\nconst results = await transcribeDirectory(\n  '.\u002Faudio-recordings',\n  '.\u002Ftranscriptions.json'\n);\n\nconsole.log(`\\nProcessed ${results.totalFiles} files`);\nconsole.log(`Successful: ${results.transcriptions.filter(t => t.success).length}`);\nconsole.log(`Failed: ${results.transcriptions.filter(t => !t.success).length}`);\n```\n\n## Best Practices\n\n### 1. Audio Format Handling\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeAnyFormat(audioFilePath) {\n  \u002F\u002F Supported formats: WAV, MP3, M4A, FLAC, OGG, etc.\n  const validExtensions = ['.wav', '.mp3', '.m4a', '.flac', '.ogg'];\n  const ext = audioFilePath.toLowerCase().substring(audioFilePath.lastIndexOf('.'));\n\n  if (!validExtensions.includes(ext)) {\n    throw new Error(`Unsupported audio format: ${ext}`);\n  }\n\n  const zai = await ZAI.create();\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return response.text;\n}\n```\n\n### 2. Error Handling\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function safeTranscribe(audioFilePath) {\n  try {\n    \u002F\u002F Validate file exists\n    if (!fs.existsSync(audioFilePath)) {\n      throw new Error(`File not found: ${audioFilePath}`);\n    }\n\n    \u002F\u002F Check file size (e.g., limit to 100MB)\n    const stats = fs.statSync(audioFilePath);\n    const fileSizeMB = stats.size \u002F (1024 * 1024);\n    \n    if (fileSizeMB > 100) {\n      throw new Error(`File too large: ${fileSizeMB.toFixed(2)}MB (max 100MB)`);\n    }\n\n    \u002F\u002F Transcribe\n    const zai = await ZAI.create();\n    const audioFile = fs.readFileSync(audioFilePath);\n    const base64Audio = audioFile.toString('base64');\n\n    const response = await zai.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    if (!response.text || response.text.trim().length === 0) {\n      throw new Error('Empty transcription result');\n    }\n\n    return {\n      success: true,\n      transcription: response.text,\n      filePath: audioFilePath,\n      fileSize: stats.size\n    };\n  } catch (error) {\n    console.error('Transcription error:', error);\n    return {\n      success: false,\n      error: error.message,\n      filePath: audioFilePath\n    };\n  }\n}\n```\n\n### 3. Post-Processing Transcriptions\n\n```javascript\nfunction cleanTranscription(text) {\n  \u002F\u002F Remove excessive whitespace\n  text = text.replace(\u002F\\s+\u002Fg, ' ').trim();\n\n  \u002F\u002F Capitalize first letter of sentences\n  text = text.replace(\u002F(^\\w|[.!?]\\s+\\w)\u002Fg, match => match.toUpperCase());\n\n  \u002F\u002F Remove filler words (optional)\n  const fillers = ['um', 'uh', 'ah', 'like', 'you know'];\n  const fillerPattern = new RegExp(`\\\\b(${fillers.join('|')})\\\\b`, 'gi');\n  text = text.replace(fillerPattern, '').replace(\u002F\\s+\u002Fg, ' ');\n\n  return text;\n}\n\nasync function transcribeAndClean(audioFilePath) {\n  const zai = await ZAI.create();\n  \n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return {\n    raw: response.text,\n    cleaned: cleanTranscription(response.text)\n  };\n}\n```\n\n## Common Use Cases\n\n1. **Meeting Transcription**: Convert recorded meetings into searchable text\n2. **Interview Processing**: Transcribe interviews for analysis and documentation\n3. **Podcast Transcription**: Create text versions of podcast episodes\n4. **Voice Notes**: Convert voice memos to text for easier reference\n5. **Call Center Analytics**: Analyze customer service calls\n6. **Accessibility**: Provide text alternatives for audio content\n7. **Voice Commands**: Enable voice-controlled applications\n8. **Language Learning**: Transcribe pronunciation practice\n\n## Integration Examples\n\n### Express.js API Endpoint\n\n```javascript\nimport express from 'express';\nimport multer from 'multer';\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nconst app = express();\nconst upload = multer({ dest: 'uploads\u002F' });\n\nlet zaiInstance;\n\nasync function initZAI() {\n  zaiInstance = await ZAI.create();\n}\n\napp.post('\u002Fapi\u002Ftranscribe', upload.single('audio'), async (req, res) => {\n  try {\n    if (!req.file) {\n      return res.status(400).json({ error: 'No audio file provided' });\n    }\n\n    const audioFile = fs.readFileSync(req.file.path);\n    const base64Audio = audioFile.toString('base64');\n\n    const response = await zaiInstance.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    \u002F\u002F Clean up uploaded file\n    fs.unlinkSync(req.file.path);\n\n    res.json({\n      success: true,\n      transcription: response.text,\n      wordCount: response.text.split(\u002F\\s+\u002F).length\n    });\n  } catch (error) {\n    \u002F\u002F Clean up on error\n    if (req.file && fs.existsSync(req.file.path)) {\n      fs.unlinkSync(req.file.path);\n    }\n\n    res.status(500).json({\n      success: false,\n      error: error.message\n    });\n  }\n});\n\ninitZAI().then(() => {\n  app.listen(3000, () => {\n    console.log('ASR API running on port 3000');\n  });\n});\n```\n\n## Troubleshooting\n\n**Issue**: \"SDK must be used in backend\"\n- **Solution**: Ensure z-ai-web-dev-sdk is only imported in server-side code\n\n**Issue**: Empty or incorrect transcription\n- **Solution**: Verify audio quality and format. Check if audio contains clear speech\n\n**Issue**: Large file processing fails\n- **Solution**: Consider splitting large audio files into smaller segments\n\n**Issue**: Slow transcription speed\n- **Solution**: Implement caching for repeated transcriptions, optimize file sizes\n\n**Issue**: Memory errors with large files\n- **Solution**: Process files in chunks or increase Node.js memory limit\n\n## Performance Tips\n\n1. **Reuse SDK Instance**: Create once, use multiple times\n2. **Implement Caching**: Cache transcriptions for duplicate files\n3. **Batch Processing**: Process multiple files efficiently with proper queuing\n4. **Audio Optimization**: Compress audio files before processing when possible\n5. **Async Operations**: Use Promise.all for parallel processing when appropriate\n\n## Audio Quality Guidelines\n\nFor best transcription results:\n- **Sample Rate**: 16kHz or higher\n- **Format**: WAV, MP3, or M4A recommended\n- **Noise Level**: Minimize background noise\n- **Speech Clarity**: Clear pronunciation and normal speaking pace\n- **File Size**: Under 100MB recommended for individual files\n\n## Remember\n\n- Always use z-ai-web-dev-sdk in backend code only\n- The SDK is already installed - import as shown in examples\n- Audio files must be converted to base64 before processing\n- Implement proper error handling for production applications\n- Consider audio quality for best transcription accuracy\n- Clean up temporary files after processing\n- Cache results for frequently transcribed files\n","# ASR (Speech to Text) Skill\n\nThis skill guides the implementation of speech-to-text (ASR) functionality using the z-ai-web-dev-sdk package, enabling accurate transcription of spoken audio into text.\n\n## Skills Path\n\n**Skill Location**: `{project_path}\u002Fskills\u002FASR`\n\nthis skill is located at above path in your project.\n\n**Reference Scripts**: Example test scripts are available in the `{Skill Location}\u002Fscripts\u002F` directory for quick testing and reference. See `{Skill Location}\u002Fscripts\u002Fasr.ts` for a working example.\n\n## Overview\n\nSpeech-to-Text (ASR - Automatic Speech Recognition) allows you to build applications that convert spoken language in audio files into written text, enabling voice-controlled interfaces, transcription services, and audio content analysis.\n\n**IMPORTANT**: z-ai-web-dev-sdk MUST be used in backend code only. Never use it in client-side code.\n\n## Prerequisites\n\nThe z-ai-web-dev-sdk package is already installed. Import it as shown in the examples below.\n\n## CLI Usage (For Simple Tasks)\n\nFor simple audio transcription tasks, you can use the z-ai CLI instead of writing code. This is ideal for quick transcriptions, testing audio files, or batch processing.\n\n### Basic Transcription from File\n\n```bash\n# Transcribe an audio file\nz-ai asr --file .\u002Faudio.wav\n\n# Save transcription to JSON file\nz-ai asr -f .\u002Frecording.mp3 -o transcript.json\n\n# Transcribe and view output\nz-ai asr --file .\u002Finterview.wav --output result.json\n```\n\n### Transcription from Base64\n\n```bash\n# Transcribe from base64 encoded audio\nz-ai asr --base64 \"UklGRiQAAABXQVZFZm10...\" -o result.json\n\n# Using short option\nz-ai asr -b \"base64_encoded_audio_data\" -o transcript.json\n```\n\n### Streaming Output\n\n```bash\n# Stream transcription results\nz-ai asr -f .\u002Faudio.wav --stream\n```\n\n### CLI Parameters\n\n- `--file, -f \u003Cpath>`: **Required** (if not using --base64) - Audio file path\n- `--base64, -b \u003Cbase64>`: **Required** (if not using --file) - Base64 encoded audio\n- `--output, -o \u003Cpath>`: Optional - Output file path (JSON format)\n- `--stream`: Optional - Stream the transcription output\n\n### Supported Audio Formats\n\nThe ASR service supports various audio formats including:\n- WAV (.wav)\n- MP3 (.mp3)\n- Other common audio formats\n\n### When to Use CLI vs SDK\n\n**Use CLI for:**\n- Quick audio file transcriptions\n- Testing audio recognition accuracy\n- Simple batch processing scripts\n- One-off transcription tasks\n\n**Use SDK for:**\n- Real-time audio transcription in applications\n- Integration with recording systems\n- Custom audio processing workflows\n- Production applications with streaming audio\n\n## Basic ASR Implementation\n\n### Simple Audio Transcription\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeAudio(audioFilePath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Read audio file and convert to base64\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return response.text;\n}\n\n\u002F\u002F Usage\nconst transcription = await transcribeAudio('.\u002Faudio.wav');\nconsole.log('Transcription:', transcription);\n```\n\n### Transcribe Multiple Audio Files\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeBatch(audioFilePaths) {\n  const zai = await ZAI.create();\n  const results = [];\n\n  for (const filePath of audioFilePaths) {\n    try {\n      const audioFile = fs.readFileSync(filePath);\n      const base64Audio = audioFile.toString('base64');\n\n      const response = await zai.audio.asr.create({\n        file_base64: base64Audio\n      });\n\n      results.push({\n        file: filePath,\n        success: true,\n        transcription: response.text\n      });\n    } catch (error) {\n      results.push({\n        file: filePath,\n        success: false,\n        error: error.message\n      });\n    }\n  }\n\n  return results;\n}\n\n\u002F\u002F Usage\nconst files = ['.\u002Finterview1.wav', '.\u002Finterview2.wav', '.\u002Finterview3.wav'];\nconst transcriptions = await transcribeBatch(files);\n\ntranscriptions.forEach(result => {\n  if (result.success) {\n    console.log(`${result.file}: ${result.transcription}`);\n  } else {\n    console.error(`${result.file}: Error - ${result.error}`);\n  }\n});\n```\n\n## Advanced Use Cases\n\n### Audio File Processing with Metadata\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\nimport path from 'path';\n\nasync function transcribeWithMetadata(audioFilePath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Get file metadata\n  const stats = fs.statSync(audioFilePath);\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const startTime = Date.now();\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  const endTime = Date.now();\n\n  return {\n    filename: path.basename(audioFilePath),\n    filepath: audioFilePath,\n    fileSize: stats.size,\n    transcription: response.text,\n    wordCount: response.text.split(\u002F\\s+\u002F).length,\n    processingTime: endTime - startTime,\n    timestamp: new Date().toISOString()\n  };\n}\n\n\u002F\u002F Usage\nconst result = await transcribeWithMetadata('.\u002Fmeeting_recording.wav');\nconsole.log('Transcription Details:', JSON.stringify(result, null, 2));\n```\n\n### Real-time Audio Processing Service\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nclass ASRService {\n  constructor() {\n    this.zai = null;\n    this.transcriptionCache = new Map();\n  }\n\n  async initialize() {\n    this.zai = await ZAI.create();\n  }\n\n  generateCacheKey(audioBuffer) {\n    const crypto = require('crypto');\n    return crypto.createHash('md5').update(audioBuffer).digest('hex');\n  }\n\n  async transcribe(audioFilePath, useCache = true) {\n    const audioBuffer = fs.readFileSync(audioFilePath);\n    const cacheKey = this.generateCacheKey(audioBuffer);\n\n    \u002F\u002F Check cache\n    if (useCache && this.transcriptionCache.has(cacheKey)) {\n      return {\n        transcription: this.transcriptionCache.get(cacheKey),\n        cached: true\n      };\n    }\n\n    \u002F\u002F Transcribe audio\n    const base64Audio = audioBuffer.toString('base64');\n\n    const response = await this.zai.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    \u002F\u002F Cache result\n    if (useCache) {\n      this.transcriptionCache.set(cacheKey, response.text);\n    }\n\n    return {\n      transcription: response.text,\n      cached: false\n    };\n  }\n\n  clearCache() {\n    this.transcriptionCache.clear();\n  }\n\n  getCacheSize() {\n    return this.transcriptionCache.size;\n  }\n}\n\n\u002F\u002F Usage\nconst asrService = new ASRService();\nawait asrService.initialize();\n\nconst result1 = await asrService.transcribe('.\u002Faudio.wav');\nconsole.log('First call (not cached):', result1);\n\nconst result2 = await asrService.transcribe('.\u002Faudio.wav');\nconsole.log('Second call (cached):', result2);\n```\n\n### Directory Transcription\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\nimport path from 'path';\n\nasync function transcribeDirectory(directoryPath, outputJsonPath) {\n  const zai = await ZAI.create();\n\n  \u002F\u002F Get all audio files\n  const files = fs.readdirSync(directoryPath);\n  const audioFiles = files.filter(file => \n    \u002F\\.(wav|mp3|m4a|flac|ogg)$\u002Fi.test(file)\n  );\n\n  const results = {\n    directory: directoryPath,\n    totalFiles: audioFiles.length,\n    processedAt: new Date().toISOString(),\n    transcriptions: []\n  };\n\n  for (const filename of audioFiles) {\n    const filePath = path.join(directoryPath, filename);\n\n    try {\n      const audioFile = fs.readFileSync(filePath);\n      const base64Audio = audioFile.toString('base64');\n\n      const response = await zai.audio.asr.create({\n        file_base64: base64Audio\n      });\n\n      results.transcriptions.push({\n        filename: filename,\n        success: true,\n        text: response.text,\n        wordCount: response.text.split(\u002F\\s+\u002F).length\n      });\n\n      console.log(`✓ Transcribed: ${filename}`);\n    } catch (error) {\n      results.transcriptions.push({\n        filename: filename,\n        success: false,\n        error: error.message\n      });\n\n      console.error(`✗ Failed: ${filename} - ${error.message}`);\n    }\n  }\n\n  \u002F\u002F Save results to JSON\n  fs.writeFileSync(\n    outputJsonPath,\n    JSON.stringify(results, null, 2)\n  );\n\n  return results;\n}\n\n\u002F\u002F Usage\nconst results = await transcribeDirectory(\n  '.\u002Faudio-recordings',\n  '.\u002Ftranscriptions.json'\n);\n\nconsole.log(`\\nProcessed ${results.totalFiles} files`);\nconsole.log(`Successful: ${results.transcriptions.filter(t => t.success).length}`);\nconsole.log(`Failed: ${results.transcriptions.filter(t => !t.success).length}`);\n```\n\n## Best Practices\n\n### 1. Audio Format Handling\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function transcribeAnyFormat(audioFilePath) {\n  \u002F\u002F Supported formats: WAV, MP3, M4A, FLAC, OGG, etc.\n  const validExtensions = ['.wav', '.mp3', '.m4a', '.flac', '.ogg'];\n  const ext = audioFilePath.toLowerCase().substring(audioFilePath.lastIndexOf('.'));\n\n  if (!validExtensions.includes(ext)) {\n    throw new Error(`Unsupported audio format: ${ext}`);\n  }\n\n  const zai = await ZAI.create();\n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return response.text;\n}\n```\n\n### 2. Error Handling\n\n```javascript\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nasync function safeTranscribe(audioFilePath) {\n  try {\n    \u002F\u002F Validate file exists\n    if (!fs.existsSync(audioFilePath)) {\n      throw new Error(`File not found: ${audioFilePath}`);\n    }\n\n    \u002F\u002F Check file size (e.g., limit to 100MB)\n    const stats = fs.statSync(audioFilePath);\n    const fileSizeMB = stats.size \u002F (1024 * 1024);\n    \n    if (fileSizeMB > 100) {\n      throw new Error(`File too large: ${fileSizeMB.toFixed(2)}MB (max 100MB)`);\n    }\n\n    \u002F\u002F Transcribe\n    const zai = await ZAI.create();\n    const audioFile = fs.readFileSync(audioFilePath);\n    const base64Audio = audioFile.toString('base64');\n\n    const response = await zai.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    if (!response.text || response.text.trim().length === 0) {\n      throw new Error('Empty transcription result');\n    }\n\n    return {\n      success: true,\n      transcription: response.text,\n      filePath: audioFilePath,\n      fileSize: stats.size\n    };\n  } catch (error) {\n    console.error('Transcription error:', error);\n    return {\n      success: false,\n      error: error.message,\n      filePath: audioFilePath\n    };\n  }\n}\n```\n\n### 3. Post-Processing Transcriptions\n\n```javascript\nfunction cleanTranscription(text) {\n  \u002F\u002F Remove excessive whitespace\n  text = text.replace(\u002F\\s+\u002Fg, ' ').trim();\n\n  \u002F\u002F Capitalize first letter of sentences\n  text = text.replace(\u002F(^\\w|[.!?]\\s+\\w)\u002Fg, match => match.toUpperCase());\n\n  \u002F\u002F Remove filler words (optional)\n  const fillers = ['um', 'uh', 'ah', 'like', 'you know'];\n  const fillerPattern = new RegExp(`\\\\b(${fillers.join('|')})\\\\b`, 'gi');\n  text = text.replace(fillerPattern, '').replace(\u002F\\s+\u002Fg, ' ');\n\n  return text;\n}\n\nasync function transcribeAndClean(audioFilePath) {\n  const zai = await ZAI.create();\n  \n  const audioFile = fs.readFileSync(audioFilePath);\n  const base64Audio = audioFile.toString('base64');\n\n  const response = await zai.audio.asr.create({\n    file_base64: base64Audio\n  });\n\n  return {\n    raw: response.text,\n    cleaned: cleanTranscription(response.text)\n  };\n}\n```\n\n## Common Use Cases\n\n1. **Meeting Transcription**: Convert recorded meetings into searchable text\n2. **Interview Processing**: Transcribe interviews for analysis and documentation\n3. **Podcast Transcription**: Create text versions of podcast episodes\n4. **Voice Notes**: Convert voice memos to text for easier reference\n5. **Call Center Analytics**: Analyze customer service calls\n6. **Accessibility**: Provide text alternatives for audio content\n7. **Voice Commands**: Enable voice-controlled applications\n8. **Language Learning**: Transcribe pronunciation practice\n\n## Integration Examples\n\n### Express.js API Endpoint\n\n```javascript\nimport express from 'express';\nimport multer from 'multer';\nimport ZAI from 'z-ai-web-dev-sdk';\nimport fs from 'fs';\n\nconst app = express();\nconst upload = multer({ dest: 'uploads\u002F' });\n\nlet zaiInstance;\n\nasync function initZAI() {\n  zaiInstance = await ZAI.create();\n}\n\napp.post('\u002Fapi\u002Ftranscribe', upload.single('audio'), async (req, res) => {\n  try {\n    if (!req.file) {\n      return res.status(400).json({ error: 'No audio file provided' });\n    }\n\n    const audioFile = fs.readFileSync(req.file.path);\n    const base64Audio = audioFile.toString('base64');\n\n    const response = await zaiInstance.audio.asr.create({\n      file_base64: base64Audio\n    });\n\n    \u002F\u002F Clean up uploaded file\n    fs.unlinkSync(req.file.path);\n\n    res.json({\n      success: true,\n      transcription: response.text,\n      wordCount: response.text.split(\u002F\\s+\u002F).length\n    });\n  } catch (error) {\n    \u002F\u002F Clean up on error\n    if (req.file && fs.existsSync(req.file.path)) {\n      fs.unlinkSync(req.file.path);\n    }\n\n    res.status(500).json({\n      success: false,\n      error: error.message\n    });\n  }\n});\n\ninitZAI().then(() => {\n  app.listen(3000, () => {\n    console.log('ASR API running on port 3000');\n  });\n});\n```\n\n## Troubleshooting\n\n**Issue**: \"SDK must be used in backend\"\n- **Solution**: Ensure z-ai-web-dev-sdk is only imported in server-side code\n\n**Issue**: Empty or incorrect transcription\n- **Solution**: Verify audio quality and format. Check if audio contains clear speech\n\n**Issue**: Large file processing fails\n- **Solution**: Consider splitting large audio files into smaller segments\n\n**Issue**: Slow transcription speed\n- **Solution**: Implement caching for repeated transcriptions, optimize file sizes\n\n**Issue**: Memory errors with large files\n- **Solution**: Process files in chunks or increase Node.js memory limit\n\n## Performance Tips\n\n1. **Reuse SDK Instance**: Create once, use multiple times\n2. **Implement Caching**: Cache transcriptions for duplicate files\n3. **Batch Processing**: Process multiple files efficiently with proper queuing\n4. **Audio Optimization**: Compress audio files before processing when possible\n5. **Async Operations**: Use Promise.all for parallel processing when appropriate\n\n## Audio Quality Guidelines\n\nFor best transcription results:\n- **Sample Rate**: 16kHz or higher\n- **Format**: WAV, MP3, or M4A recommended\n- **Noise Level**: Minimize background noise\n- **Speech Clarity**: Clear pronunciation and normal speaking pace\n- **File Size**: Under 100MB recommended for individual files\n\n## Remember\n\n- Always use z-ai-web-dev-sdk in backend code only\n- The SDK is already installed - import as shown in examples\n- Audio files must be converted to base64 before processing\n- Implement proper error handling for production applications\n- Consider audio quality for best transcription accuracy\n- Clean up temporary files after processing\n- Cache results for frequently transcribed files\n",{"name":5,"license":14,"description":7},"main","7ee19d9efa6123ac0eb02ec3f4a0382dc27e97ae","skills\u002FASR","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews","https:\u002F\u002Fgithub.com\u002Fnordeim","A freelance IT engineer","2026-06-24 17:56:29",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add nordeim\u002Fonestopnews --skill ASR",{"tool":37,"command":38},"bunx","bunx skills add nordeim\u002Fonestopnews --skill ASR",{"tool":40,"command":41},"pnpm","pnpm dlx skills add nordeim\u002Fonestopnews --skill ASR","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002FASR\u002FSKILL.md",true,[45,50],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":15},"LICENSE.txt","LICENSE","许可证",1080,{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"scripts\u002Fasr.ts","SCRIPT","脚本",650,"https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002FASR\u002Fscripts\u002Fasr.ts",[57,66,74,82,89,97],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":61,"licenseFileUrl":62,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M75DXKQMDVYG9H9GP6SZSR02","webapp-testing","Web application testing principles. E2E, Playwright, deep audit strategies.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":70,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M75DX35MS8HZ92CBW2Z9JYD3","web-search","Implement web search capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to search for real-time information from the web, retrieve up-to-date content beyond the knowledge cutoff, or find the latest news and data. Returns structured search results with URLs, snippets, and metadata.","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fweb-search\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fweb-search\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":78,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M75DWYHQ360A0TEKMNGN5S2H","web-reader","Implement web page content extraction capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to scrape web pages, extract article content, retrieve page metadata, or build applications that process web content. Supports automatic content extraction with title, HTML, and publication time retrieval.","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fweb-reader\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fweb-reader\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M75DWR41MFHYZWKZQW7W46VJ","web-frameworks","Build modern full-stack web applications with Next.js (App Router, Server Components, RSC, PPR, SSR, SSG, ISR), Turborepo (monorepo management, task pipelines, remote caching, parallel execution), and RemixIcon (3100+ SVG icons in outlined\u002Ffilled styles). Use when creating React applications, implementing server-side rendering, setting up monorepos with multiple packages, optimizing build performance and caching strategies, adding icon libraries, managing shared dependencies, or working with TypeScript full-stack projects.","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fweb-frameworks\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":93,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M75DW8W3ZF2QX40KJYW47FGK","video-understand","Implement specialized video understanding capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to analyze video content, understand motion and temporal sequences, extract information from video frames, describe video scenes, or perform video-based AI analysis. Optimized for MP4, AVI, MOV, and other common video formats.","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fvideo-understand\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fvideo-understand\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":101,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M75DW3S2J8BT0BYNFNMMJMKD","video-generation","Implement AI-powered video generation capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to generate videos from text prompts or images, create video content programmatically, or build applications that produce video outputs. Supports asynchronous task management with status polling and result retrieval.","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fvideo-generation\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fnordeim\u002Fonestopnews\u002Fblob\u002Fmain\u002Fskills\u002Fvideo-generation\u002FSKILL.md",[],[]]