Get Credits
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.decart.ai/v1/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.decart.ai/v1/credits"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.get("https://api.decart.ai/v1/credits")
.header("x-api-key", "<api-key>")
.asString();val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.decart.ai/v1/credits")
.get()
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let url = URL(string: "https://api.decart.ai/v1/credits")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))curl --request GET \
--url https://api.decart.ai/v1/credits \
--header 'x-api-key: <api-key>'{
"credits": 123,
"key_quota": {
"limit": 123,
"used": 123,
"remaining": 123,
"resets_at": "2023-11-07T05:31:56Z"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Credits
Get Credits
Credits the authenticated API key can spend right now.
For most keys, credits is the balance of the account the key belongs to: your personal balance for a personal key, the organization’s balance for an organization key. A key with a credit cap gets its remaining cap instead, along with key_quota, and the organization’s balance isn’t shown to it.
The balance includes charges that have already posted. Realtime sessions are charged while they run, and batch jobs are charged when they finish.
Call this endpoint from your server with your API key. Client tokens are refused with 403. Poll at most once per second.
GET
/
v1
/
credits
Get Credits
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.decart.ai/v1/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.decart.ai/v1/credits"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.get("https://api.decart.ai/v1/credits")
.header("x-api-key", "<api-key>")
.asString();val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.decart.ai/v1/credits")
.get()
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let url = URL(string: "https://api.decart.ai/v1/credits")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))curl --request GET \
--url https://api.decart.ai/v1/credits \
--header 'x-api-key: <api-key>'{
"credits": 123,
"key_quota": {
"limit": 123,
"used": 123,
"remaining": 123,
"resets_at": "2023-11-07T05:31:56Z"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
API key for authentication
Was this page helpful?