{"openapi":"3.1.0","info":{"title":"Filament Calculator API","version":"1.0.0","description":"3D-printing filament maths as an API, computed locally and deterministically. The length-weight endpoint converts between the length and the weight of a spool of filament from its diameter (1.75 mm or 2.85 mm) and material density, using weight = (π/4·d²·length)·density — so one metre of 1.75 mm PLA weighs about 2.98 g, a standard 1 kg PLA spool holds roughly 335 m, and the same weight of the lighter ABS gives about 400 m. The cost endpoint computes the filament cost of a print from the weight or length used and the price per kilogram, and the spool-remaining endpoint turns a remaining-weight measurement (weigh the spool, subtract the empty-spool weight) into the remaining length so you know whether a job will finish. Built-in densities cover PLA, ABS, PETG, TPU, nylon, ASA, PC, HIPS, PVA, wood-fill and carbon-fibre blends, or supply your own. Diameters are in millimetres, lengths in metres and weights in grams. Everything is computed locally and deterministically, so it is instant and private. Ideal for 3D-printing, maker, print-farm, slicer-plugin, prototyping and STEM-education app developers, filament-usage and print-cost tools, and workshop software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is filament geometry and cost; for tank or material volume use a volume API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/filament-api","description":"oanor gateway"}],"tags":[{"name":"Filament"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/cost":{"get":{"operationId":"get_v1_cost","tags":["Filament"],"summary":"Print cost","description":"","parameters":[{"name":"weight_g","in":"query","required":false,"description":"Weight used (g)","schema":{"type":"string"},"example":"25"},{"name":"length_m","in":"query","required":false,"description":"Or length used (m)","schema":{"type":"string"}},{"name":"price_per_kg","in":"query","required":true,"description":"Filament price per kg","schema":{"type":"string"},"example":"20"},{"name":"material","in":"query","required":false,"description":"Material","schema":{"type":"string"},"example":"pla"},{"name":"diameter","in":"query","required":false,"description":"Diameter (mm)","schema":{"type":"string"},"example":"1.75"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"cost":0.5,"note":"Cost = (weight_g / 1000) · price_per_kg. 25 g of filament at 20 per kg costs 0.50.","inputs":{"diameter":1.75,"material":"pla","weight_g":25,"price_per_kg":20},"weight_g":25},"meta":{"timestamp":"2026-06-05T19:50:20.067Z","request_id":"c74f72cc-732e-4db3-92fb-04aff6029054"},"status":"ok","message":"Print cost","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/length-weight":{"get":{"operationId":"get_v1_length_weight","tags":["Filament"],"summary":"Length ↔ weight","description":"","parameters":[{"name":"length_m","in":"query","required":false,"description":"Length (m) → weight","schema":{"type":"string"},"example":"335"},{"name":"weight_g","in":"query","required":false,"description":"Weight (g) → length","schema":{"type":"string"},"example":"1000"},{"name":"material","in":"query","required":false,"description":"pla, abs, petg, tpu, nylon, asa…","schema":{"type":"string"},"example":"pla"},{"name":"diameter","in":"query","required":false,"description":"Diameter (mm, default 1.75)","schema":{"type":"string"},"example":"1.75"},{"name":"density","in":"query","required":false,"description":"Custom density (g/cm³)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Weight = length · (π/4·d²·density). 1 m of 1.75 mm PLA ≈ 2.98 g.","inputs":{"density":1.24,"diameter":1.75,"length_m":335,"material":"pla"},"weight_g":999.1541,"grams_per_meter":2.98255},"meta":{"timestamp":"2026-06-05T19:50:20.188Z","request_id":"128765f3-00ed-46fc-970a-6c3e075e74af"},"status":"ok","message":"Length/weight conversion","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/spool-remaining":{"get":{"operationId":"get_v1_spool_remaining","tags":["Filament"],"summary":"Remaining spool length","description":"","parameters":[{"name":"remaining_weight_g","in":"query","required":true,"description":"Remaining filament weight (g)","schema":{"type":"string"},"example":"250"},{"name":"material","in":"query","required":false,"description":"Material","schema":{"type":"string"},"example":"pla"},{"name":"diameter","in":"query","required":false,"description":"Diameter (mm)","schema":{"type":"string"},"example":"1.75"},{"name":"density","in":"query","required":false,"description":"Custom density (g/cm³)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Remaining length = remaining weight / grams-per-metre. Weigh the spool, subtract the empty-spool weight, and convert.","inputs":{"density":1.24,"diameter":1.75,"material":"pla","remaining_weight_g":250},"grams_per_meter":2.98255,"remaining_length_m":83.8209},"meta":{"timestamp":"2026-06-05T19:50:20.295Z","request_id":"668bbaea-28b1-4092-bea1-5a3ed620b8dc"},"status":"ok","message":"Spool remaining length","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"notes":"Diameter in mm (default 1.75), density in g/cm³ (or a named material: pla, abs, petg, tpu, nylon, asa, pc, hips, pva, wood, carbon-fiber). Lengths in metres, weights in grams.","service":"filament-api","endpoints":{"GET /v1/cost":"Print cost from filament used and price per kg.","GET /v1/meta":"This document.","GET /v1/length-weight":"Convert filament length ↔ weight.","GET /v1/spool-remaining":"Remaining length from remaining weight on a spool."},"materials":["pla","abs","petg","tpu","nylon","asa","pc","hips","pva","wood","carbon-fiber"],"description":"3D-printing filament: length ↔ weight via diameter and density, print cost, and remaining spool length."},"meta":{"timestamp":"2026-06-05T19:50:20.404Z","request_id":"06c64237-e2f9-4be4-9d15-029e9f43da62"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":7800,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":410,"monthly_call_quota":78000,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1120,"monthly_call_quota":340000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":3500,"monthly_call_quota":1800000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/filament-api"}