#[SOLVED] /v1/organization/costs always returning 500

1 messages · Page 1 of 1 (latest)

loud jungle
#

Hi there!
I'm trying to use this endpoint to get some easy away to track cost growth. But... until now, I never got a single 200 status code. Every time, 500 error. I checked the parameters; I'm using a admin api key with all permissions. I'm stucked in this error. This is de CURL I'm using, with bearer token omited

curl --request GET \
  --url 'https://api.openai.com/v1/organization/costs?start_time=1754006400000&end_time=1754092800000' \
  --header 'Authorization: Bearer sk-admin-XXXX' \
  --cookie '__cf_bm=rx4IhuT7KeJB6RiTk4bzKlWlx6uc.F8z1yIHyD.lsd0-1756139591-1.0.1.1-bgz1F8PQijpsRML81nFFQ6uZ19UVRNaIjH7fz3fB2QX0z.oluJTy0qem_p42AREEN3LirLNDHBvP1AaYcdB0nNUN9NzhuYqd7GaeOCbrIjU; _cfuvid=Pf8RtwQ.gXwd3O.QSU9H0HMq2LqvD9gLQKIlpTI0d_A-1756139591624-0.0.1.1-604800000'

And this is the server response:

{
    "error": {
        "message": "The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID req_7a77a55ee9137477fbd89b1258e893e4 in your email.)",
        "type": "server_error",
        "param": null,
        "code": null
    }
}
ancient coral
loud jungle
#

OMG! The cookie isn't the problem - it's something Insomnia add. But God... so stupid I was! As you suggested, I used the sample and worked. Why? The UNIX timestamp!

I'm using, for example, 1754006400000. Cutting 3 zeros and voilà! With 1754006400 worked!