Merge pull request #1926 from BerriAI/litellm_ui_further_improvements

Enable viewing key alias instead of hashed tokens
This commit is contained in:
Krish Dholakia 2024-02-10 20:52:23 -08:00 committed by GitHub
commit a36aa6aa01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 151 additions and 30 deletions

View file

@ -202,6 +202,36 @@ export const userSpendLogsCall = async (
}
};
export const keyInfoCall = async (accessToken: String, keys: String[]) => {
try {
let url = proxyBaseUrl ? `${proxyBaseUrl}/v2/key/info` : `/key/info`;
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
keys: keys,
}),
});
if (!response.ok) {
const errorData = await response.text();
message.error(errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log(data);
return data;
} catch (error) {
console.error("Failed to create key:", error);
throw error;
}
};
export const spendUsersCall = async (accessToken: String, userID: String) => {
try {
const url = proxyBaseUrl ? `${proxyBaseUrl}/spend/users` : `/spend/users`;