cuopt-routing-api-python

A Python-only guide for solving vehicle-routing problems with NVIDIA cuOpt, including delivery routes, traveling-salesperson tours, and pickup-and-delivery plans.

In plain words
What is it for?
Use it to build Python routing solutions for fleets with depots, delivery demands, vehicle capacities, arrival deadlines, service times, or pickup-before-delivery requirements.
Why use it?
It helps translate locations, vehicles, orders, capacities, time windows, and ordering rules into a cuOpt model instead of leaving those constraints implicit or incomplete.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nvidia/cuopt/cuopt-routing-api-python
Any agent
npx skills add NVIDIA/cuopt --skill cuopt-routing-api-python
Clone the repo
git clone --depth 1 https://github.com/NVIDIA/cuopt

Made for: Claude Code, Codex.

Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 933 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.00933
Opus 5 $0.00018 $0.00466
Sonnet 5 $0.00007 $0.00187
Haiku 4.5 $0.00004 $0.00093

Measured yesterday against content hash def1266eecee, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cuopt-routing-api-python scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

The scan reads SKILL.md. This mod also ships 2 executable files (assets/pdp_basic/model.py, assets/vrp_basic/model.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- [server_examples.md](references/server_examples.md) — REST client (curl, Python)
Origin

This is a copy

100% identical to cuopt-routing-api-python — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/cuopt-routing-api-python/SKILL.md · 123 lines

How it starts

The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.

cuOpt Routing — Python API

This skill is Python only. Routing has no C API in cuOpt.

Required questions

Ask these if not already clear:

  1. Problem type — TSP, VRP, or PDP?
  2. Locations — How many? Depot(s)? Cost or distance between pairs (matrix or derived)?
  3. Orders / tasks — Which locations must be visited? Demand or service per stop?
  4. Fleet — Number of vehicles, capacity per vehicle (and per dimension if multiple), start/end locations?
  5. Constraints — Time windows (earliest/latest arrival), service times, precedence (order A before B)?

Minimal VRP Example

import cudf
from cuopt import routing

cost_matrix = cudf.DataFrame([...], dtype="float32")
dm = routing.DataModel(n_locations=4, n_fleet=2, n_orders=3)
dm.add_cost_matrix(cost_matrix)
dm.set_order_locations(cudf.Series([1, 2, 3], dtype="int32"))
solution = routing.Solve(dm, routing.SolverSettings())

if solution.get_status() == 0:
    solution.display_routes()

Adding Constraints

# Time windows
dm.add_transit_time_matrix(transit_time_matrix)
dm.set_order_time_windows(earliest_series, latest_series)

# Capacities
dm.add_capacity_dimension("weight", demand_series, capacity_series)
dm.set_order_service_times(service_times)
dm.set_vehicle_locations(start_locations, end_locations)
dm.set_vehicle_time_windows(earliest_start, latest_return)

# Pickup-delivery pairs
dm.set_pickup_delivery_pairs(pickup_indices, delivery_indices)

# Precedence
dm.add_order_precedence(node_id=2, preceding_nodes=np.array([0, 1]))

Solution Checking

status = solution.get_status()  # 0=SUCCESS, 1=FAIL, 2=TIMEOUT, 3=EMPTY
if status == 0:
    route_df = solution.get_route()
    total_cost = solution.get_total_objective()
else:
    print(solution.get_error_message())
    print(solution.get_infeasible_orders().to_list())

Data Types (use explicit dtypes)

cost_matrix = cost_matrix.astype("float32")
order_locations = cudf.Series([...], dtype="int32")
demand = cudf.Series([...], dtype="int32")

Read the full file on GitHub · 123 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 123 lines · 37 tokens per session scan A def1266eecee

Subscribe to this mod's changes

cuopt-routing-api-python is a skill published in the GitHub repository NVIDIA/cuopt (1,032 stars, last pushed 3d ago), licensed Apache-2.0. It adds 37 tokens to every session and 933 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to cuopt-routing-api-python, differing in 0 lines, and is treated as a copy.