Billing for separate users or pods
Hi is there any way to track usage (in terms of cost) for pods (for example based on ID) or better if there is a way to see how much each of my team user has cost?
43 Replies
Hmm no i dont think thats possible
Except you try to track it manually or automatically using external application
Any idea how to track it? Either manually or is there an app that can do that?
Yes, by noting who uses that, calculate by the price time running on the pod
I don't know what app is available for that yet
for example
You get the basic idea now yeah
Thanks yeah that helps!
How do I get the running time of a pod?
I can get pod ID from
runpodctl get pod <pod-id>
is there a way to get the running time of the pod?Try checking the graphql api
https://graphql-spec.runpod.io/#query-myself
and the pod graphql query
Those can be used
So
Will allow me to get the data on myself as a user?
Uhh that's graphql i think that's not how you query it
Try using postman
I'll check
I haven't used graphql queries before
curl --location 'https://api.runpod.io/graphql?api_key=pewpew' \
--header 'Content-Type: application/json' \
--data '{"query":"query cpuTypes {\r\n cpuTypes {\r\n id\r\n displayName\r\n manufacturer\r\n cores\r\n threadsPerCore\r\n }\r\n}","variables":{}}'
So basically thats how you use graphql
the query in body
Can you share a doc for reference or examples
Hmm search graphql
im using postman for this
chatgpt generated this. Maybe this can work too
I think use params instead of headers for authorization
'https://api.runpod.io/graphql?api_key=pewpew
Like this
Okay. But even with this how will I get the running time of pods?
can you help how to query for this?
Hmm
Check the pod query ?
Okay
I wonder what will this return in a team account. Because I want to query for a specific user
Hmm not sure im rarely using graphql
It returned for the main account only. And it gives uptimeseconds: 0 if the pod is in exited state. I dont think it gives the total uptime for a pod or specifc to a user
This helped
What would be the input
oh nice
Any idea what could be the $input?
or how to set it?
let me try
wait
{"input": {"podId": "jdw3kl6vcaaz8x"}}
not sure why the uptimeseconds is always 0 lol
Yeah I am getting 0 as well. Wait.. even when the pod is running it shows 0?
Is there any way to query audit logs other than the console?
yeah
You can get most things by inspecting your browser
might work
such as?
runtime {
uptimeInSeconds
}
Should work
But you can only get runtime when the pod is actually running, otherwise the GraphQL query fails
curl --location 'https://api.runpod.io/graphql?api_key=Pewpew' \
--header 'Content-Type: application/json' \
--data '{"query":"query GetAuditLogs($input:AuditLogInput!){auditLogs(input:$input){edges{ownerId,actorId,email,resourceType,resourceId,action}}}","variables":{"input":{"ownerId":"user_XXXXX","limit":202}}}'
Oh there
Inspect in browser? Or via the graphql query using postman and/or curl
@digigoblin @nerdylive
Graphql postman works
Hmm why is runtime null
not sure. are you able to get a value?
I get a value
Is your pod actually running?
it was not running at the time. Does it only give the runtime for that session or for its entire life, until terminated?
runtime only returns results for pods that are actually running
And doesn't include total life of the pod
Yes I am getting a value as well while the pod is running
Oh alright then