@@ -47,6 +47,7 @@ import {
4747 OPENROUTER_DEFAULT_PROVIDER_NAME ,
4848} from "@/components/ui/hooks/useOpenRouterModelProviders"
4949import { useOpenRouterKeyInfo } from "@/components/ui/hooks/useOpenRouterKeyInfo"
50+ import { useRequestyKeyInfo } from "@/components/ui/hooks/useRequestyKeyInfo"
5051import { MODELS_BY_PROVIDER , PROVIDERS , AWS_REGIONS , VERTEX_REGIONS } from "./constants"
5152import { VSCodeButtonLink } from "../common/VSCodeButtonLink"
5253import { ModelInfoView } from "./ModelInfoView"
@@ -74,6 +75,24 @@ const OpenRouterBalanceDisplay = ({ apiKey, baseUrl }: { apiKey: string; baseUrl
7475 )
7576}
7677
78+ const RequestyBalanceDisplay = ( { apiKey } : { apiKey : string } ) => {
79+ const { data : keyInfo } = useRequestyKeyInfo ( apiKey )
80+
81+ if ( ! keyInfo ) {
82+ return null
83+ }
84+
85+ // Parse the balance to a number and format it to 2 decimal places
86+ const balance = parseFloat ( keyInfo . org_balance )
87+ const formattedBalance = balance . toFixed ( 2 )
88+
89+ return (
90+ < VSCodeLink href = "https://app.requesty.ai/settings" className = "text-vscode-foreground hover:underline" >
91+ ${ formattedBalance }
92+ </ VSCodeLink >
93+ )
94+ }
95+
7796interface ApiOptionsProps {
7897 uriScheme : string | undefined
7998 apiConfiguration : ApiConfiguration
@@ -427,7 +446,12 @@ const ApiOptions = ({
427446 onInput = { handleInputChange ( "requestyApiKey" ) }
428447 placeholder = { t ( "settings:providers.getRequestyApiKey" ) }
429448 className = "w-full" >
430- < label className = "block font-medium mb-1" > { t ( "settings:providers.requestyApiKey" ) } </ label >
449+ < div className = "flex justify-between items-center mb-1" >
450+ < label className = "block font-medium" > { t ( "settings:providers.requestyApiKey" ) } </ label >
451+ { apiConfiguration ?. requestyApiKey && (
452+ < RequestyBalanceDisplay apiKey = { apiConfiguration . requestyApiKey } />
453+ ) }
454+ </ div >
431455 </ VSCodeTextField >
432456 < div className = "text-sm text-vscode-descriptionForeground -mt-2" >
433457 { t ( "settings:providers.apiKeyStorageNotice" ) }
0 commit comments