DEV Community

orhansavash
orhansavash

Posted on

US import duty from Python: every tariff layer for an HTS code, free (pip install zentria-flow)

If you sell physical products into the US, "what is the duty on this?" stopped having one answer. A cotton T-shirt from China doesn't pay its 16.5% MFN rate. It pays 36.5%, because two more tariffs sit on top. Christmas lights from China pay 45.5%; the same lights from Vietnam pay 20.5%.

Spreadsheets get this wrong because the layers come from different legal programs, each with its own exemptions and dates. So we put our tariff engine behind a free API and wrapped it in a small Python package.

pip install zentria-flow
Enter fullscreen mode Exit fullscreen mode

No key, no account, no dependencies (standard library only).

One line, every layer

$ zentria-flow check 9405.31.00 CN
HTS 9405.31.00 from CN  (entry date 2026-11-20)
  Luminaires and lighting fittings ... not elsewhere specified or included
  MFN duty                                8%
  Section 301                            25%  (List 3)
  Forced-labor Section 301 tariff      12.5%  (applies)
  Section 232                             0%
  Section 338 (Canada)                    0%
  Total US duty                        45.5%
Enter fullscreen mode Exit fullscreen mode

Same thing in Python:

from zentriaflow import Client

c = Client()
r = c.tariff_check("6109.10.00", "CN")   # cotton T-shirt
r.total_rate                              # 36.5
[(l["label"], l["rate"]) for l in r.layers]
# [('MFN duty', 16.5), ('Section 301', 7.5), ('Forced-labor Section 301 tariff', 12.5),
#  ('Section 232', 0.0), ('Section 338 (Canada)', 0.0)]
r.duty(12_000)                            # 4380.0
Enter fullscreen mode Exit fullscreen mode

Rates have dates

US duty is set on the day goods are entered, not ordered. Kitchen cabinets from Vietnam pay 25% today and 50% from 1 January 2027 (Section 232 on wood products). Pass an entry date to see it:

$ zentria-flow check 9403.40.9060 VN --as-of 2027-01-02
  ...
  Section 232                            50%
  Total US duty                          50%
Enter fullscreen mode Exit fullscreen mode

Every answer also carries scheduled_changes: the changes already dated for that line, with the rate before and after. zentria-flow calendar --origin VN lists every dated change that hits an origin.

Moving a supplier? Compare first

$ zentria-flow compare 9503.00.00 CN VN
HTS 9503.00.00, total US duty, lowest first:
  CN     12.5%
  VN     12.5%
Enter fullscreen mode Exit fullscreen mode

Toys: the China Section 301 tariff on this line is suspended, so what is left is the forced-labor tariff, the same 12.5% for both. Moving toy production from China to Vietnam saves nothing on US duty.

A whole product list

$ cat products.csv
hts,origin,value
9405.31.00,CN,20000
9405.31.00,VN,20000
9505.10.25,CN,8000
$ zentria-flow price products.csv > priced.csv
Enter fullscreen mode Exit fullscreen mode

Each row gets total_rate, duty and next_change. In Python it is c.price_rows(rows).

Limits and honesty

  • The free API allows about 60 tariff checks an hour per IP. Client(wait_on_limit=True) waits and retries once.
  • Answers are planning estimates, not customs rulings. Anti-dumping and countervailing duties are company-specific and are not in any total.
  • Classification is the importer's job; zentria-flow search "christmas lights" lists candidate HTS lines, it doesn't pick one for you.

The package is MIT licensed: github.com/orhansavash/zentria-flow-python, on PyPI as zentria-flow. The same engine is in Google Sheets (=ZF_DUTY("6109.10.00","China")), in an MCP server for Claude, and on the web at zentriaflow.com.

Which product should we check next? Leave an HTS code and a country in the comments.

Drafted with AI assistance; every command above was re-run against the live package on 20 Nov 2026.

Top comments (0)