You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I have code like this, hardcoding the model cost into my custom provider, and returning the total cost that way.
// ...constinputCost=0.00025/1000;//@TODO: Get from provider instead?constoutputCost=0.00125/1000;//@TODO: Get from provider instead?consttotalCost=inputCost*usage.promptTokens+outputCost*usage.completionTokens||undefined;return{// Requiredoutput: object,// OptionaltokenUsage: {total: usage.totalTokens,prompt: usage.promptTokens,completion: usage.completionTokens},cost: totalCost};
From what I can see, it's not exposed currently, but it'd be super cool if I would be able to look up the model name via the provider, "claude-3-haiku-20240307", and get the cost model back to be used in the custom provider like this. 🙌
The text was updated successfully, but these errors were encountered:
Would recommend attempting to extract $/tokens this from the API providers, as opposed to adding manually - the cost for input and output tokens seems to be changing fairly rapidly.
Currently I have code like this, hardcoding the model cost into my custom provider, and returning the total cost that way.
From what I can see, it's not exposed currently, but it'd be super cool if I would be able to look up the model name via the provider, "claude-3-haiku-20240307", and get the cost model back to be used in the custom provider like this. 🙌
The text was updated successfully, but these errors were encountered: