HONG KONG — China has bought more than $1 trillion of American debt, but as the global downturn has intensified, Beijing is starting to keep more of its money at home, a move that could have painful effects for American borrowers.

The declining Chinese appetite for United States debt, apparent in a series of hints from Chinese policy makers over the last two weeks, with official statistics due for release in the next few days, comes at an inconvenient time.

On Tuesday, President-elect Barack Obama predicted the possibility of trillion-dollar deficits “for years to come,” even after an $800 billion stimulus package. Normally, China would be the most avid taker of the debt required to pay for those deficits, mainly short-term Treasuries, which are government i.o.u.’s.

In the last five years, China has spent as much as one-seventh of its entire economic output buying foreign debt, mostly American. In September, it surpassed Japan as the largest overseas holder of Treasuries.