|
|
@@ -47,6 +47,7 @@ import {
|
|
|
OPENROUTER_DEFAULT_PROVIDER_NAME,
|
|
|
} from "@/components/ui/hooks/useOpenRouterModelProviders"
|
|
|
import { useOpenRouterKeyInfo } from "@/components/ui/hooks/useOpenRouterKeyInfo"
|
|
|
+import { useRequestyKeyInfo } from "@/components/ui/hooks/useRequestyKeyInfo"
|
|
|
import { MODELS_BY_PROVIDER, PROVIDERS, AWS_REGIONS, VERTEX_REGIONS } from "./constants"
|
|
|
import { VSCodeButtonLink } from "../common/VSCodeButtonLink"
|
|
|
import { ModelInfoView } from "./ModelInfoView"
|
|
|
@@ -74,6 +75,24 @@ const OpenRouterBalanceDisplay = ({ apiKey, baseUrl }: { apiKey: string; baseUrl
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+const RequestyBalanceDisplay = ({ apiKey }: { apiKey: string }) => {
|
|
|
+ const { data: keyInfo } = useRequestyKeyInfo(apiKey)
|
|
|
+
|
|
|
+ if (!keyInfo) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+
|
|
|
+ // Parse the balance to a number and format it to 2 decimal places
|
|
|
+ const balance = parseFloat(keyInfo.org_balance)
|
|
|
+ const formattedBalance = balance.toFixed(2)
|
|
|
+
|
|
|
+ return (
|
|
|
+ <VSCodeLink href="https://app.requesty.ai/settings" className="text-vscode-foreground hover:underline">
|
|
|
+ ${formattedBalance}
|
|
|
+ </VSCodeLink>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
interface ApiOptionsProps {
|
|
|
uriScheme: string | undefined
|
|
|
apiConfiguration: ApiConfiguration
|
|
|
@@ -427,7 +446,12 @@ const ApiOptions = ({
|
|
|
onInput={handleInputChange("requestyApiKey")}
|
|
|
placeholder={t("settings:providers.getRequestyApiKey")}
|
|
|
className="w-full">
|
|
|
- <label className="block font-medium mb-1">{t("settings:providers.requestyApiKey")}</label>
|
|
|
+ <div className="flex justify-between items-center mb-1">
|
|
|
+ <label className="block font-medium">{t("settings:providers.requestyApiKey")}</label>
|
|
|
+ {apiConfiguration?.requestyApiKey && (
|
|
|
+ <RequestyBalanceDisplay apiKey={apiConfiguration.requestyApiKey} />
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
</VSCodeTextField>
|
|
|
<div className="text-sm text-vscode-descriptionForeground -mt-2">
|
|
|
{t("settings:providers.apiKeyStorageNotice")}
|