Bike hire will be available for free on prescription, as part of a new pilot scheme at GP surgeries.
Cardiff and Vale health board said, as of Wednesday, GPs at two practices in the capital could refer patients.
Doctors can prescribe six months of nextbike membership for people who need to do more exercise or lose weight.
Public health consultant Dr Tom Porter said it was "one of the easiest ways to reduce your risk of ill health while building your cardiovascular fitness".
The health board said the project was a UK-first and would be available to doctors at Lansdowne Surgery and Fairwater Health Centre.
Once prescribed, patients will be given a code which allows them unlimited free 30-minute hires.
GP Dr Karen Pardy said: "Whilst we are aware of the many benefits of exercise for our patients, people are sometimes reluctant to engage.
"nextbike on prescription allows people to have a go at cycling around Cardiff and realise how this can help to support their overall wellbeing."
Dr Porter said regular cycling could cut someone's risk of dying from heart disease in half.
nextbike launched in Cardiff in May 2018 and the firm said it now had 500 bikes at 27 sites, with about 10,000 journeys made each week.
Usual fees vary, depending on a subscription, but non-members pay £1 for the first 30 minutes, with £1 for every additional half an hour after that - up to a maximum of £10 a day.
Dr Porter, who works for the health board and Public Health Wales, said patients would be asked for feedback with a view to rolling the scheme out city-wide.
Cardiff council's cabinet member for health, Susan Elsmore, said the city was "incredibly fortunate and proud to offer this opportunity".