DocumentationSDKs
SDKs
Typed Python and TypeScript clients for the dino.markets API: install, make a call, read your plan headers and handle errors.
What the SDKs do
Both clients call https://api.dino.markets with your API key as a bearer token, so you do not build requests or decode responses yourself. They cover the same routes as the API reference.
- Prices and other decimal values are exact. Python returns
Decimalobjects and TypeScript returns decimal strings, never floats. - Failures are typed errors that carry the problem response’s
code,detailandrequest_id. - Requests retry up to twice for per-minute rate limits and temporary unavailability. A used monthly quota is not retried.
- Every response carries your plan and what is left of its monthly requests.
Create a key in the dashboard and keep it in your server’s secret configuration as DINO_API_KEY. Both clients read that variable. Keep the key out of browser code.
Python
The package is dino-markets and needs Python 3.10 or newer.
pip install dino-markets
This call reads the latest gold spot price in US dollars. It counts as one request against your plan.
from dino_markets import Dino
with Dino() as client:
gold = client.commodities.spot_price("XAU", "USD")
print(gold.price)
print(gold.meta.plan, gold.meta.requests.remaining)
AsyncDino is the asynchronous client, used with async with and await. Pass api_key= to set the key in code instead of the environment.
TypeScript
The package is dino-markets and needs Node.js 22 or newer.
npm install dino-markets
Run this on your server as an ES module:
import { Dino } from "dino-markets";
const client = new Dino();
const gold = await client.commodities.spotPrice("XAU", "USD");
console.log(gold.price);
console.log(gold.meta.plan, gold.meta.requests?.remaining);
Pass apiKey in the constructor options to set the key in code instead of the environment.
Plan headers on every response
The meta field of each response holds the request id and the four plan headers described in errors and limits.
| Field | Header | Meaning |
|---|---|---|
meta.request_id |
X-Request-Id |
The id to quote to support. |
meta.plan |
X-Dino-Plan |
Your plan code. |
meta.requests.limit |
X-Dino-Requests-Limit |
Requests included in the month. |
meta.requests.remaining |
X-Dino-Requests-Remaining |
Requests left after this call. |
meta.requests.reset |
X-Dino-Requests-Reset |
When the monthly count resets (the 1st, 00:00 UTC). |
Errors
Every error extends one base class, DinoError. API errors are ApiError and its subclasses BadRequest, Unauthorized, NotFound and RateLimited. Each carries status, code, detail and request_id. RateLimited also carries retry_after, and its is_quota_exhausted property is true when the plan’s monthly requests are used up.
from dino_markets import Dino, errors
with Dino() as client:
try:
client.commodities.spot_price("XAU", "USD")
except errors.RateLimited as error:
if error.is_quota_exhausted:
print("Monthly requests used; they renew on the 1st")
else:
print("Slow down; retry after", error.retry_after, "seconds")
except errors.ApiError as error:
print(error.status, error.code, error.request_id)
In TypeScript the same classes are exported from the package root and used with instanceof.
Start with a free key
3,000 requests a month, no card needed.