
OSRM, Valhalla, GraphHopper, and NextBillion.ai all calculate routes, but they differ in licensing, deployment, map-data control, vehicle handling, and support. This article compares them for self-hosted apps, logistics and fleet software, truck routing, and enterprise deployments in the US. No universal winner here, only workload-dependent fits.
Key Takeaways
- OSRM, Valhalla, and GraphHopper are open source; NextBillion.ai is a commercial API with on-premise options.
- Match the engine to the workload: self-hosted speed, multimodal flexibility, configurable open source, or managed enterprise routing.
- Truck restrictions, traffic, matrix scale, and map editing matter more than benchmark speed.
- Total cost includes servers, engineering, map updates, monitoring, and support.
Overview of Routing Engines in the US Market
A routing engine computes paths over a road network and returns geometry, travel time, distance, and sometimes turn instructions. For example, OSRM's route service finds the fastest path between coordinates, and its table service computes pairwise time and distance matrices.
Routing engines differ from related tools:
- GPS navigation supplies turn-by-turn directions along a computed route.
- Map matching snaps raw GPS traces to roads.
- Route optimization assigns stops to vehicles and sequences visits under time windows, capacity, and driver constraints.
In the US, this stack powers delivery, field service, fleet management, and mobility apps. Common outputs include ETAs, matrices for dispatch, vehicle-specific profiles, and trace reconstruction.
The operating models differ. OSRM and Valhalla are open-source projects you run yourself. GraphHopper offers an open-source engine plus a hosted commercial API suite. NextBillion.ai is an API-first commercial platform with cloud, private cloud, and on-premise deployment.
Best Routing Engines Compared: OSRM vs Valhalla vs GraphHopper vs NextBillion.ai
Each option is compared on route quality, travel modes, truck restrictions, traffic handling, customization, API maturity, deployment, scale, pricing, and support. Keep one distinction in mind: every engine here uses road data, and OpenStreetMap data carries its own ODbL attribution obligations regardless of the engine's software license.
NextBillion.ai
NextBillion.ai is an API-first routing and location platform for logistics, fleet, last-mile, field service, and mobility companies. Its Directions API handles departure-time routing, live and historical traffic, and truck-aware constraints. Separate APIs cover distance matrices, route optimization, navigation, and snap-to-road.

Where it stands out:
- Truck parameters cover dimensions, weight, axle load, hazardous cargo, and emission class.
- Synchronous Fast matrices default to 1000x1000 and reach 5000x5000; Flexible mode is 50x50.
- Route Optimization publishes support for up to 10,000 stops, a vendor claim rather than an independent benchmark.
- The Map Editor changes road access, turn restrictions, speeds, and truck limits without code.
- Deployment spans shared cloud, dedicated private cloud, and on-premise Kubernetes behind your firewall.
Note the boundary: routing APIs calculate paths, while the Route Optimization API handles multi-stop assignment with 50+ constraints. Pricing can be per order, per vehicle, or per API call, with a fixed-monthly option; no public dollar rate is published.
| Attribute | NextBillion.ai |
|---|---|
| Deployment | Cloud, private cloud, on-premise |
| Pricing | Per order, asset, or call; annual commitment, monthly payment option |
| Features | Directions, matrix, optimization, navigation, snap-to-road |
| Vehicles | Truck dimensions, weight, hazmat |
| Customization | Map Editor, custom road attributes |
| Support | Solution engineers, 99.9% uptime SLA on contract |
| Best for | Fleet and truck workloads needing managed support |
OSRM
OSRM is a BSD 2-Clause C++ engine built on OpenStreetMap, and a common pick for self-hosted routing. It's actively maintained: v26.10.0 shipped October 1, 2026.
Strengths:
- Services include
route,table,match,trip,nearest, andtile. - Contraction Hierarchies and Multi-Level Dijkstra give you speed or update flexibility.
- You control the full stack.
Trade-offs:
- Profiles are Lua scripts chosen at preprocessing, not per-request vehicle definitions. Changing them means reprocessing.
- The car profile handles height, width, length, and weight, but real truck behavior needs a suitable custom profile.
- Traffic comes through CSV speed files; MLD reruns customization without repartitioning. There is no documented departure-time forecast API.
tripis a greedy heuristic, not a multi-vehicle optimizer.
| Attribute | OSRM |
|---|---|
| Deployment | Self-hosted |
| License | BSD 2-Clause |
| Modes | Car, bicycle, foot profiles |
| Map pipeline | extract, then contract or partition/customize |
| Traffic | External speed-file updates |
| Best for | High-performance self-hosted routing with engineering capacity |
Valhalla
Valhalla is an MIT-licensed engine with tiled graphs and runtime costing. Version 3.9.1 is the latest stable release.
Where it fits:
- Costing models include
auto,bicycle,pedestrian,truck,motorcycle,bus,taxi, andmultimodal. - Truck costing accepts height, weight, axle load, and hazmat per request.
- Request-level
date_timesupports current departure, specified departure, specified arrival, and invariant time. - APIs cover
/route,/sources_to_targets,/isochrone,/trace_route, and/optimized_route.
Caveats: transit needs your own GTFS feeds. Historical traffic ingestion exists, but you still source the feed. Traffic and arrival-time routing exclude multimodal costing.
optimized_route visits stops once with fixed endpoints, so it isn't a full fleet VRP solver. Expect real work in tile builds, refreshes, tuning, and monitoring.
| Attribute | Valhalla |
|---|---|
| Deployment | Self-hosted |
| License | MIT |
| Modes | Auto, truck, bike, pedestrian, multimodal |
| Traffic | Historical and live ingestion, not multimodal |
| Map data | Tiled graph, regional updates |
| Best for | Multiple modes and runtime routing control |
GraphHopper
GraphHopper splits into two products. The Apache 2.0 engine runs as a Java library or web server, with routing, map matching, isochrones, and public transit. The hosted Directions API adds Matrix, Geocoding, and Route Optimization (built on jsprit).
Differentiators:
- Profiles include
car,small_truck,truck,bike, andfoot. The open-sourcetruck.jsonmodel defaults to 3 m wide, 4 m high, and 18 t. - JSON custom models adjust speed, priority, and distance influence in the open-source project.
- CH, LM, and flexible modes trade query speed for flexibility.
- Hosted pricing runs from a free non-commercial tier to Basic at €69, Standard at €199, and Premium at €479 per month, billed in credits.
Don't assume the hosted suite equals the engine. Live traffic and road closures belong to the commercial offering, not the Apache engine. Public pricing for commercial on-premise Directions API licensing is not listed, so ask GraphHopper directly.
| Attribute | GraphHopper |
|---|---|
| Deployment | Self-hosted or hosted API |
| License/pricing | Apache 2.0; credit-based hosted tiers |
| Vehicles | Car, small truck, truck, bike, foot |
| Customization | JSON custom models |
| Traffic | Commercial add-on |
| Best for | Configurable open source with a hosted fallback |

Best Fit by Scenario
All conclusions are workload-dependent:
- Self-hosted performance: OSRM
- Multimodal routing: Valhalla
- Configurable open source with a commercial path: GraphHopper
- Managed enterprise APIs and complex truck or fleet operations: NextBillion.ai
How We Chose the Best Routing Engines
We avoided three common mistakes: comparing a raw engine to a managed API on price alone, treating route calculation as full optimization, and trusting synthetic benchmarks.
No controlled three-way benchmark of OSRM, Valhalla, and GraphHopper is available in published research, so we rank no one on latency. As Blum and Storandt's ICAPS study notes, single-network comparisons can't establish scalability.
We ranked each engine on three dimensions:
Technical capability:
- Route quality, matrix size, and throughput
- Profile flexibility, traffic or time dependence, map matching
Commercial and operational fit:
- License obligations, hosting, cloud versus on-premise
- Documentation, support access, security, and engineering effort
Logistics requirements:
- Truck dimensions, hazmat, time windows, capacity, and driver rules
- Whether a separate optimization layer is needed
Truck data has limits too. OSM tags like maxheight, maxweight, and hazmat exist, but no authoritative figure measures US-wide completeness. Treat restriction coverage as something to test.
Run a proof of concept before committing:
- Pick representative US routes with production-like inputs.
- Compare distance, duration, and restricted-road violations.
- Measure ETA accuracy, response time, and failure recovery.
- Track map-update effort and total cost at expected volume.

Verify each feature against current official docs, and note whether it needs configuration, a paid tier, third-party data, or custom engineering.
Conclusion
The best engine depends on your deployment model, map data, travel modes, vehicle restrictions, traffic needs, scale, and engineering capacity. No single engine ranks first for every use case.
Compare production-like routes, total cost of ownership, support, and integration effort before choosing OSRM, Valhalla, GraphHopper, or NextBillion.ai.
If you're building logistics, fleet, delivery, or transportation software, evaluate NextBillion.ai's routing and optimization APIs against your own workload. A trial API key and technical assessment make a practical proof of concept.
Frequently Asked Questions
What does IP route 0.0.0.0/0 do?
It's the IPv4 default route. Routers use it to forward traffic when no more specific route exists. It's a network setting, unrelated to map routing engines.
What is routing and why is it used?
Network routing picks forwarding paths for IP packets; map routing picks paths over roads. Both choose a route through a network based on destinations, costs, and constraints.
Which of OSRM, Valhalla, GraphHopper, and NextBillion.ai is best for self-hosting?
OSRM, Valhalla, and the GraphHopper engine give full infrastructure control, with you running updates. NextBillion.ai offers on-premise deployment with vendor support. It depends on how much operational work you want.
Which routing engine is best for truck routing?
It depends on restrictions, dimensions, hazmat rules, traffic inputs, and optimization needs. Valhalla, GraphHopper, and NextBillion.ai accept truck parameters. Verify current support and test representative routes.
Is an open-source routing engine cheaper than a managed routing API?
Open source removes license fees but adds servers, DevOps, map updates, monitoring, and custom development. Compare total cost of ownership, not headline pricing.
How should I benchmark routing engines before choosing one?
Use identical map data, profiles, vehicle constraints, stop volumes, matrix sizes, and traffic conditions. Measure quality, latency, reliability, map maintenance, integration effort, and operating cost.


