{"record":{"id":"94f284892ae68534","repo":"HeyPuter/puter","slug":"insufficient-funds-94f284","errorCode":"insufficient_funds","errorMessage":"Insufficient funds","messagePattern":"Insufficient funds","errorType":"http","errorClass":"HttpError","httpStatus":402,"severity":"error","filePath":"src/backend/drivers/ai-tts/providers/speechify/SpeechifyTTSProvider.ts","lineNumber":162,"sourceCode":"                    },\n                },\n            );\n        }\n\n        const voice = voiceArg || DEFAULT_VOICE;\n        const format = output_format || response_format || 'mp3';\n\n        const actor = Context.get('actor')!;\n        const usageType = `speechify:${model}:character`;\n        const ucentsPerChar = SPEECHIFY_TTS_COSTS[model] ?? 0;\n        const totalCost = ucentsPerChar * text.length;\n\n        const usageAllowed = await this.meteringService.hasEnoughCredits(\n            actor,\n            totalCost,\n        );\n        if (!usageAllowed) {\n            throw new HttpError(402, 'Insufficient funds', {\n                legacyCode: 'insufficient_funds',\n            });\n        }\n\n        // Speechify's synthesis endpoint expects SSML; wrap plain text so\n        // callers can keep passing bare strings like every other provider.\n        const input = /<speak[\\s>]/i.test(text)\n            ? text\n            : `<speak>${text}</speak>`;\n\n        const response = await fetch(`${API_BASE}/v1/audio/speech`, {\n            method: 'POST',\n            headers: {\n                Authorization: `Bearer ${this.#apiKey}`,\n                'Content-Type': 'application/json',\n                [CALLER_HEADER]: CALLER_VALUE,\n            },\n            body: JSON.stringify({","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-tts/providers/speechify/SpeechifyTTSProvider.ts#L144-L180","documentation":"Error \"Insufficient funds\" thrown in HeyPuter/puter.","triggerScenarios":"Thrown at src/backend/drivers/ai-tts/providers/speechify/SpeechifyTTSProvider.ts:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add credits to the account before retrying the TTS request.","Reduce usage or upgrade the plan to restore sufficient funds."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}