metric-space-ai / octopus_client

The frontend of octopus software
Mozilla Public License 2.0
0 stars 2 forks source link

use new report API endpoint to provide information about token usage #91

Open asyncfncom opened 1 month ago

asyncfncom commented 1 month ago

Here is an endpoint https://api.likora.octopus-ai.app/swagger-ui/#/chat_token_audits/report

It returns data in the following format

{
    "ends_at": "2024-07-31T11:06:48.273586170Z",
    "report": {
        "test1@test.com": {
            "openai": {
                "gpt-4o-mini-2024-07-18": {
                    "input_tokens": 641,
                    "output_tokens": 1067
                },
                "gpt-4o-2024-05-13": {
                    "input_tokens": 1201,
                    "output_tokens": 676
                }
            },
            "azure_openai": {
                "gpt-4o-mini-2024-07-18": {
                    "input_tokens": 1062,
                    "output_tokens": 403
                }
            }
        }
    },
    "starts_at": "2024-07-01T00:00:00Z"
}

You can provide a dates this way http://vm03:8080/api/v1/chat-token-audits/1519c2d3-763c-48e2-9788-503ceb747be8/report?ends_at=2024-07-29T13:21:38Z&starts_at=2024-07-01T22:00:00Z

asyncfncom commented 1 month ago

You need to create a page where reports about token usage will be displayed.