return cost 0 for free users

This commit is contained in:
joshualipman123 2025-08-25 12:51:00 -07:00 committed by daniel-lxs
parent 59b036ccff
commit b8094b30a7
No known key found for this signature in database
GPG key ID: 21C74479048B3AA6
13 changed files with 23 additions and 1 deletions

View file

@ -23,6 +23,7 @@ interface VercelAiGatewayUsage extends OpenAI.CompletionUsage {
prompt_tokens_details?: {
cached_tokens?: number
}
cost?: number
}
export class VercelAiGatewayHandler extends RouterProvider implements SingleCompletionHandler {
@ -83,6 +84,7 @@ export class VercelAiGatewayHandler extends RouterProvider implements SingleComp
outputTokens: usage.completion_tokens || 0,
cacheWriteTokens: usage.cache_creation_input_tokens || undefined,
cacheReadTokens: usage.prompt_tokens_details?.cached_tokens || undefined,
totalCost: usage.cost ?? 0,
}
}
}

View file

@ -7,6 +7,7 @@ import type { OrganizationAllowList } from "@roo/cloud"
import type { RouterModels } from "@roo/api"
import { useAppTranslation } from "@src/i18n/TranslationContext"
import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink"
import { inputEventTransform } from "../transforms"
import { ModelPicker } from "../ModelPicker"
@ -52,6 +53,14 @@ export const VercelAiGateway = ({
<div className="text-sm text-vscode-descriptionForeground -mt-2">
{t("settings:providers.apiKeyStorageNotice")}
</div>
{!apiConfiguration?.vercelAiGatewayApiKey && (
<VSCodeButtonLink
href="https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=AI+Gateway+API+Key"
appearance="primary"
style={{ width: "100%" }}>
{t("settings:providers.getVercelAiGatewayApiKey")}
</VSCodeButtonLink>
)}
<ModelPicker
apiConfiguration={apiConfiguration}
setApiConfigurationField={setApiConfigurationField}

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter API-Schlüssel",
"getOpenRouterApiKey": "OpenRouter API-Schlüssel erhalten",
"vercelAiGatewayApiKey": "Vercel AI Gateway API-Schlüssel",
"getVercelAiGatewayApiKey": "Vercel AI Gateway API-Schlüssel erhalten",
"doubaoApiKey": "Doubao API-Schlüssel",
"getDoubaoApiKey": "Doubao API-Schlüssel erhalten",
"apiKeyStorageNotice": "API-Schlüssel werden sicher im VSCode Secret Storage gespeichert",

View file

@ -233,6 +233,7 @@
"openRouterApiKey": "OpenRouter API Key",
"getOpenRouterApiKey": "Get OpenRouter API Key",
"vercelAiGatewayApiKey": "Vercel AI Gateway API Key",
"getVercelAiGatewayApiKey": "Get Vercel AI Gateway API Key",
"apiKeyStorageNotice": "API keys are stored securely in VSCode's Secret Storage",
"glamaApiKey": "Glama API Key",
"getGlamaApiKey": "Get Glama API Key",
@ -759,7 +760,7 @@
}
},
"modelPicker": {
"automaticFetch": "The extension automatically fetches the latest list of models available on <serviceLink>{{serviceName}}</serviceLink>. If you're unsure which model to choose, Roo Code works best with <defaultModelLink>{{defaultModelId}}</defaultModelLink>. You can also try searching \"free\" for no-cost options currently available.",
"automaticFetch": "Note: Free tier users will see $0 costs as these requests are provided at no charge by Vercel AI Gateway.",
"label": "Model",
"searchPlaceholder": "Search",
"noMatchFound": "No match found",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "Clave API de OpenRouter",
"getOpenRouterApiKey": "Obtener clave API de OpenRouter",
"vercelAiGatewayApiKey": "Clave API de Vercel AI Gateway",
"getVercelAiGatewayApiKey": "Obtener clave API de Vercel AI Gateway",
"apiKeyStorageNotice": "Las claves API se almacenan de forma segura en el Almacenamiento Secreto de VSCode",
"glamaApiKey": "Clave API de Glama",
"getGlamaApiKey": "Obtener clave API de Glama",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "Clé API OpenRouter",
"getOpenRouterApiKey": "Obtenir la clé API OpenRouter",
"vercelAiGatewayApiKey": "Clé API Vercel AI Gateway",
"getVercelAiGatewayApiKey": "Obtenir la clé API Vercel AI Gateway",
"apiKeyStorageNotice": "Les clés API sont stockées en toute sécurité dans le stockage sécurisé de VSCode",
"glamaApiKey": "Clé API Glama",
"getGlamaApiKey": "Obtenir la clé API Glama",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "Chiave API OpenRouter",
"getOpenRouterApiKey": "Ottieni chiave API OpenRouter",
"vercelAiGatewayApiKey": "Chiave API Vercel AI Gateway",
"getVercelAiGatewayApiKey": "Ottieni chiave API Vercel AI Gateway",
"apiKeyStorageNotice": "Le chiavi API sono memorizzate in modo sicuro nell'Archivio Segreto di VSCode",
"glamaApiKey": "Chiave API Glama",
"getGlamaApiKey": "Ottieni chiave API Glama",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter APIキー",
"getOpenRouterApiKey": "OpenRouter APIキーを取得",
"vercelAiGatewayApiKey": "Vercel AI Gateway APIキー",
"getVercelAiGatewayApiKey": "Vercel AI Gateway APIキーを取得",
"apiKeyStorageNotice": "APIキーはVSCodeのシークレットストレージに安全に保存されます",
"glamaApiKey": "Glama APIキー",
"getGlamaApiKey": "Glama APIキーを取得",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter API 키",
"getOpenRouterApiKey": "OpenRouter API 키 받기",
"vercelAiGatewayApiKey": "Vercel AI Gateway API 키",
"getVercelAiGatewayApiKey": "Vercel AI Gateway API 키 받기",
"apiKeyStorageNotice": "API 키는 VSCode의 보안 저장소에 안전하게 저장됩니다",
"glamaApiKey": "Glama API 키",
"getGlamaApiKey": "Glama API 키 받기",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "Chave de API OpenRouter",
"getOpenRouterApiKey": "Obter chave de API OpenRouter",
"vercelAiGatewayApiKey": "Chave API do Vercel AI Gateway",
"getVercelAiGatewayApiKey": "Obter chave API do Vercel AI Gateway",
"apiKeyStorageNotice": "As chaves de API são armazenadas com segurança no Armazenamento Secreto do VSCode",
"glamaApiKey": "Chave de API Glama",
"getGlamaApiKey": "Obter chave de API Glama",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter API-ключ",
"getOpenRouterApiKey": "Получить OpenRouter API-ключ",
"vercelAiGatewayApiKey": "Ключ API Vercel AI Gateway",
"getVercelAiGatewayApiKey": "Получить ключ API Vercel AI Gateway",
"apiKeyStorageNotice": "API-ключи хранятся безопасно в Secret Storage VSCode",
"glamaApiKey": "Glama API-ключ",
"getGlamaApiKey": "Получить Glama API-ключ",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter API 密钥",
"getOpenRouterApiKey": "获取 OpenRouter API 密钥",
"vercelAiGatewayApiKey": "Vercel AI Gateway API 密钥",
"getVercelAiGatewayApiKey": "获取 Vercel AI Gateway API 密钥",
"apiKeyStorageNotice": "API 密钥安全存储在 VSCode 的密钥存储中",
"glamaApiKey": "Glama API 密钥",
"getGlamaApiKey": "获取 Glama API 密钥",

View file

@ -234,6 +234,7 @@
"openRouterApiKey": "OpenRouter API 金鑰",
"getOpenRouterApiKey": "取得 OpenRouter API 金鑰",
"vercelAiGatewayApiKey": "Vercel AI Gateway API 金鑰",
"getVercelAiGatewayApiKey": "取得 Vercel AI Gateway API 金鑰",
"apiKeyStorageNotice": "API 金鑰安全儲存於 VSCode 金鑰儲存中",
"glamaApiKey": "Glama API 金鑰",
"getGlamaApiKey": "取得 Glama API 金鑰",