Usage API suddenly not working anymore with page parameter

Hello there,

we are using the Usage API for quite a while now without any changes.

Now, we’ve got the problem that the page parameter does not longer work.

When I test with Postman and without the page URL parameter, I get a repsonse:

{
    "object": "page",
    "has_more": true,
    "next_page": "page_AAAAAGiylNSRbLlqAAAAAGiIDwA=",
    "data": [
        {
            "object": "bucket",
            "start_time": 1753660800,
            "end_time": 1753747200,
            "start_time_iso": "2025-07-28T00:00:00+00:00",
            "end_time_iso": "2025-07-29T00:00:00+00:00",
            "results": [
                {

...

}

But when I try to get results from the “next_page” and use it inside the parameter (does’n’t matter if I URL encode the = to %3D or not), I get an error and I don’t know what to do.

Is anyone able to help me figuring out what’s the problem?

Kind regards,
Erik

1 Like

I got it now through testing.

The “page” URL parameter has been renamed to “next_page”.

So it works with this:

https://api.openai.com/v1/organization/usage/completions?[…]&next_page=page_AAAAAGiyoaeRbLlqAAAAAGiIDwA%3D

1 Like

No, that doesn’t work as intended.

With this, it keeps repeating the results.

I checked further…

it looks like “has_more” is always true and next_page does always hold a different value in the response, but the result set is always the same - doesn’t matter which page I send the request to.

I’ve had this problem too.

It seems that when the length of the requested period matches exactly the end, it now gives this error. (used to be fine in the past)

The solution for me was to set an increased window length in the limit parameter.

For example, when requesting for 2 days of log:

import time
days = 2
start_time = int(time.time()) - (days * 86400) #x days ago

params = {
    "start_time": start_time,
    "bucket_width": "1d",
    "group_by":["model"],
    "limit": days+1 # increased the length of results
}

Since I changed this, I’ve had no further issues and the rest of the code remains the same.

1 Like

this was a bug in OpenAI API. Got a message from the team that it is now fixed

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.