Check your DA totals and usage history from Go.
OpenDunes bills in Algerian Dinars (DA). Internally balances are stored as micro-DA (1 DA = 1,000,000 micro-DA) to keep arithmetic integer-safe; the credits API returns DA values derived from those integers.
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
type CreditsResponse struct {
Data struct {
TotalCredits float64 `json:"total_credits"`
TotalUsage float64 `json:"total_usage"`
} `json:"data"`
}
func main() {
req, _ := http.NewRequest("GET", "https://opendunes.com/v1/credits", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENDUNES_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var credits CreditsResponse
json.NewDecoder(resp.Body).Decode(&credits)
fmt.Printf("Added: %.2f DA\n", credits.Data.TotalCredits)
fmt.Printf("Spent: %.2f DA\n", credits.Data.TotalUsage)
fmt.Printf("Remaining: %.2f DA\n", credits.Data.TotalCredits-credits.Data.TotalUsage)
}The response header X-Balance-Available on every chat completion also carries the current micro-DA balance, so you can track it without a separate call.
Fetch your daily activity — one row per day and model:
req, _ := http.NewRequest("GET", "https://opendunes.com/v1/activity", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENDUNES_API_KEY"))Each row includes the model slug, prompt/completion token totals, request count, and DA spend. Pass ?date=YYYY-MM-DD to narrow to a single day — see Analytics for the full row shape.
Deposits are credited 1:1 (deposit 1,000 DA, get 1,000 DA), and usage is billed at the DA price published in the catalog — the price you see is the price you pay.
Per-request cost = (input_tokens × input_rate) + (output_tokens × output_rate), rounded up to the nearest micro-DA (minimum 1). The model catalog at GET /api/models exposes input/output rates in DA per million tokens.
Top up your balance from your dashboard using a CIB or Edahabia card. No foreign currency or crypto accepted.