forked from phoenix/litellm-mirror
(feat) view key spend reports
This commit is contained in:
parent
fd82bad647
commit
be0cf9ff19
1 changed files with 33 additions and 0 deletions
|
@ -139,3 +139,36 @@ export const userInfoCall = async (
|
|||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const keySpendLogsCall = async (
|
||||
accessToken: String,
|
||||
token: String
|
||||
) => {
|
||||
try {
|
||||
const url = proxyBaseUrl ? `${proxyBaseUrl}/spend/logs` : `/spend/logs`;
|
||||
console.log("in keySpendLogsCall:", url)
|
||||
const response = await fetch(
|
||||
`${url}/?api_key=${token}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue