AnvilJSON utilities

Anvil › Docs › /v1/stream-data

Streaming data usage API: GB per hour, monthly allowance planner, film size

Mobile data runs out because of video, not messages. An hour of 1080p video is about 2.25 GB; an hour of music at 160 kbps is about 72 MB. This endpoint turns a month of habits into GB, says whether an allowance lasts and on which day it runs out, and finds the one quality change that saves the most.

In one line: GET /v1/stream-data?cap=15&plan=v480-1-7_feed-0.5-7_m160-1-5_call-0.5-1 returns JSON. No key, CORS on, 60 requests a minute.
GET

/v1/stream-data

Streaming data use: GB per hour, monthly allowance planner, film size, hours from GB. Change the values and press Send request to call the live API.

Parameters

NameTypeWhat it doesDefault
modestringplan (default) | size | hours | activitiesplan
capnumbermode=plan: monthly data allowance in GB—
planstringmode=plan: activity-hours_a_day-days_a_week joined by _ (up to 12)—
daysintegermode=plan: days in the billing month (1-31)30
dayintegermode=plan: today's day of the billing month (1 = start)1
usednumbermode=plan: GB already used this month0
activitystringmode=size/hours: v240, v480, v720, v1080, v4k, feed, call, callsd, voice, m96, m160, m320, pod, game, cloud, cloud720, webv1080
minutesnumbermode=size: how long the film or episode is120
gbnumbermode=hours: how many GB you have—

Example

Request:

GET https://api.oddlathe.com/v1/stream-data?cap=15&plan=v480-1-7_feed-0.5-7_m160-1-5_call-0.5-1

Response (generated by the real code when these docs were last built; random or time-based values will differ for you):

{
 "mode": "plan",
 "cap_gb": 15,
 "days": 30,
 "day": 1,
 "used_gb": 0,
 "items": [
  {
   "key": "v480",
   "label": "Video, 480p (SD)",
   "hours_a_day": 1,
   "days_a_week": 7,
   "gb_per_hour": 0.675,
   "gb_a_day": 0.675,
   "gb_a_month": 20.25
  },
  {
   "key": "feed",
   "label": "Social feeds with autoplay video",
   "hours_a_day": 0.5,
   "days_a_week": 7,
   "gb_per_hour": 0.675,
   "gb_a_day": 0.338,
   "gb_a_month": 10.12
  },
  {
   "key": "m160",
   "label": "Music, high (160 kbps)",
   "hours_a_day": 1,
   "days_a_week": 5,
   "gb_per_hour": 0.072,
   "gb_a_day": 0.051,
   "gb_a_month": 1.54
  },
  {
   "key": "call",
 …

Code examples

curl
curl 'https://api.oddlathe.com/v1/stream-data?cap=15&plan=v480-1-7_feed-0.5-7_m160-1-5_call-0.5-1'
JavaScript (browser or Node 18+)
const params = new URLSearchParams({
  cap: "15",
  plan: "v480-1-7_feed-0.5-7_m160-1-5_call-0.5-1"
});
const res = await fetch(`https://api.oddlathe.com/v1/stream-data?${params}`);
if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
console.log(data);
Python (standard library only)
import json, urllib.parse, urllib.request

params = urllib.parse.urlencode({"cap": "15", "plan": "v480-1-7_feed-0.5-7_m160-1-5_call-0.5-1"})
url = "https://api.oddlathe.com/v1/stream-data?" + params
# Send a User-Agent: the edge network refuses Python's default one.
req = urllib.request.Request(url, headers={"User-Agent": "my-script/1.0"})
with urllib.request.urlopen(req, timeout=10) as r:
    data = json.load(r)
print(data)

When it's useful

  • Phone plan comparison pages: show which allowance fits a real week of use
  • Travel eSIM and hotspot planners: will 10 GB last a fortnight away?
  • Family or student budgeting tools that warn before the allowance runs out mid-month
  • Teaching why quality settings matter more than how many apps you use

Good to know

  • mode=plan (default) needs cap (GB) and plan=v480-1-7_feed-0.5-7: each activity is key-hours_a_day-days_a_week, up to 12 joined by _. Returns per-activity gb_a_month, gb_a_day, lasts, runs_out_on_day, safe_gb_a_day, biggest and easiest_saving (the activity where dropping one quality rung saves most).
  • Mid-month check: add day=12&used=6.5 and the plan only counts the days left.
  • mode=size&activity=v1080&minutes=120 gives a film or episode's size; mode=hours&activity=v720&gb=10 how long an allowance lasts; mode=activities the full ladder with Mbps, GB per hour and MB per minute.
  • Figures are rounded typical bitrates (video ladders, music at 96/160/320 kbps, calls counted both ways). Real apps vary with content and settings; GB are decimal, as mobile networks count them.
  • Browser UI: Tooltern streaming data calculator with the same model and a run-out calendar (nothing leaves your device).

How much mobile data streaming uses, with typical rounded figures (1 Mbps for an hour is 0.45 GB). mode=plan checks a month of habits against an allowance: GB a day, whether it lasts, the day it runs out, a safe daily budget and the single biggest saving from dropping one quality rung. Pass day and used for a mid-month check. mode=size gives a film or episode's size, mode=hours how long a number of GB lasts, mode=activities the whole ladder. Pure maths; nothing is stored.

Errors

Errors are JSON like {"error": {"code": "…", "message": "…"}}. The ones this endpoint can return:

  • bad_param (400): a value is the wrong type or out of range (the message says which)
  • rate_limited (429): over 60 requests a minute; wait for Retry-After seconds

Questions

How much data does an hour of Netflix or YouTube use?

Roughly 0.7 GB at 480p, 1.35 GB at 720p, 2.25 GB at 1080p and about 7 GB at 4K. <code>/v1/stream-data?mode=activities</code> lists every rung.

Will 15 GB last a month?

It depends almost entirely on video. An hour a day of 480p, half an hour of autoplay feeds, music on weekdays and a weekly video call needs about 34 GB, so 15 GB runs out on day 14; at 240p it nearly fits.

Why 0.45 GB per Mbps per hour?

1 Mbps for 3,600 seconds is 3,600 megabits, which is 450 megabytes.

Is anything stored?

Never. Pure maths on the query string.

Related endpoints

Prefer a page to an API?

Published · OpenAPI 3.1 spec · Limits and privacy