#[Python] Get Usage for Account
6 messages · Page 1 of 1 (latest)
I don't believe they have a way to do it via the api
Oh that would be sad
api_url = "https://api.openai.com/v1/organizations/{0}]/users".format(org_id)
headers = {"Content-Type":"application/json", "authority":"api.openai.com", "scheme":"https", "path":"/v1/organizations/{0}/users", "authorization":"Bearer {1}".format(org_id, api_key)}
response = requests.post(api_url, data="", headers=headers)
response.json()```
I have found this, it doenst seem to like my org-id tho
https://community.openai.com/t/how-to-track-individual-usage/15935
I found this, but the https://api.openai.com/v1/organizations/$openai_org_id endpoint doesnt seem to contain usage information
api_url = "https://api.openai.com/v1/organizations/{0}".format(org_id)
headers = {"Content-Type":"application/json", "authorization":"Bearer {0}".format(api_key)}
response = requests.get(api_url, headers=headers)
response_json = response.content.decode('utf-8')
json_data = json.loads(response_json)
print(json_data)
return json_data```
Current code
```json
{'object': 'organization', 'id': 'org-XXXXX', 'created': 1663017908, 'title': 'Personal', 'name': 'user-XXXXX', 'description': 'Personal org for XXX@gmail.com', 'personal': True, 'is_default': True, 'role': 'owner'}```