The bending problem of functionally graded Bernoulli–Euler nanobeams is analyzed starting from a nonlocal thermodynamic approach and new nonlocal models are proposed. Nonlocal expressions of the free energy are presented, the variational formulations are then consistently provided and the differential equations with the associated higher-order boundary conditions are derived. Nonlocal Eringen and gradient elasticity constitutive models are recovered by specializing the variational scheme. Examples of nanobeams are explicitly carried out, detecting thus also new benchmarks for computational mechanics