I'm trying to calculate the cost of doing a streamText.
Based on the docs here, I was under the impression I could use gateway.getGenerationInfo({ id: generationId }) in the onFinish hook. But here I just get:
"data": { "error": "Usage event not found", "id": "gen_01KT4BW3JSXKZG1CHRJRYQASH8", "message": "No usage event found with ID gen_01KT4BW3JSXKZG1CHRJRYQASH8." }I can see that result.providerMetadata.gateway contains cost information when I log it:
{ cost: '0.00849', marketCost: '0.00849', surchargeCost: '0', gatewayCost: '0.00849', inferenceCost: '0.00849', inputInferenceCost: '0.00744', outputInferenceCost: '0.00105', generationId: 'gen_01KT4C7A322AA7XN4JV02506VR'}However this is untyped in the typescript SDK, with the type JSONObject ?
So what's the verdict here - do I parse/validate the result.providerMetadata.gateway, or should gateway.getGenerationInfo actually work?