SAN FRANCISCO -- Soon after he was diagnosed last June, Jeff Shannon, a 32-year-old photographer living in New York, got a crash course in the harsh economics of AIDS.

Shannon had no health insurance, was earning less than $15,000 a year and was already, as he put it, "barely scratching along." Facing the prospect of thousands of dollars in medical bills, not to mention supporting himself at a time when he likely would be unable to keep working, Shannon concluded he couldn't stay in New York.

Today Shannon lives in San Francisco. He gives a quarter of his $538 monthly Social Security disability check to the Shanti project, a private social service agency that provides a group house for him and three other AIDS patients. He gets basic medical care at the AIDS clinic run by the University of California at San Francisco. The city pays for an hour with a psychiatrist each week, and another private group helps pay his utility bills.

"I knew that I could find a support network in San Francisco," Shannon said. "I could actually create a life style out here that would allow me to survive. That's why I came to San Francisco."

With the country's highest per capita incidence of acquired immune deficiency syndrome, the city of San Francisco has experienced more than its share of misery and death in the past six years. But adversity has brought a more positive distinction: a reputation for having developed perhaps the most humane, cost-effective system of caring for AIDS patients in the country.

In response to the AIDS epidemic, San Francisco has dramatically expanded new, low-cost alternatives to hospitalization, such as hospice and home care. The city has established a network of community groups and volunteers to cook, clean and provide emotional counseling and financial advice, among other support services that make these alternatives possible. And AIDS has revived compassion and other feelings that intense competition and a "bottom-line" mentality in much of the health care industry have eclipsed in recent years.

In many cases, AIDS only accelerated steps that already were under way -- both in San Francisco and throughout the country -- to create a better way to care for chronically ill patients. The result is an integrated system of inpatient, outpatient and community care that not only saves money but has drawn praise for easing the worst ravages of AIDS.

Since 1982, the average length of time AIDS patients stay in San Francisco hospitals has declined from roughly 18 days to 11 days, according to Philip Lee, president of the city's health commission. The figure is considerably lower than the lengths reported in most other major cities -- for instance, more than 20 days in New York, Boston and Philadelphia and 16 days here in Washington.

This lower level of hospitalization has led to sharply lower costs per AIDS case. Researchers here have estimated that it now costs about $40,000 to treat AIDS patients from diagnosis to death in San Francisco, compared with a national average that has been calculated at more than $100,000 in various studies.Medical Costs Expected to Rise

Nationally, the direct cost of caring for AIDS patients has not reached the point where it is a significant proportion of health care expenditures. The most authoritative report on the economic costs of AIDS, by researchers at the Palo Alto Medical Foundation, calculated that the costs of medical care for all AIDS patients in 1986 was $1.1 billion, far less than one percent of the total $425 billion the country spent on health care that year.

"It will take many years, perhaps decades, before AIDS will be the kind of {financial} problem tobacco or alcohol already is," said Uve Reinhardt, a leading health economist at Princeton University.

The medical costs of AIDS are expected to escalate sharply in the years ahead, but the extent is likely to depend on a number of factors: the success of research efforts to develop a vaccine; educational efforts to curb the spread of disease; and the percentage of the estimated 1 million to 1.5 million people currently infected with the AIDS virus who eventually contract the disease.

Though epidemiologists warn the disease will spread rapidly throughout the United States, AIDS remains largely a phenomenon of big cities, such as San Francisco, New York, Los Angeles and Miami. As of Jan. 11, the Centers for Disease Control in Atlanta reported roughly 50,000 AIDS cases -- roughly a third of which have been in San Francisco and New York. By 1991, it projects that more than 270,000 people will have contracted AIDS.

In cities like San Francisco, where the numbers are overwhelming, municipal coffers face a serious and potentially debilitating drain from AIDS costs, while health workers must cope with the constant danger of "burnout." But San Francisco's lesson is that the ultimate burden, whatever it is, can be reduced through a combination of careful planning, an extensive network of volunteers and government financial support, city officials say.

Certainly no place is more acutely aware of the devastation of AIDS than this city of 700,000 people, where more than 4,600 cases have been reported.

On any given day here, about 120 people are in the hospital with AIDS in San Francisco, while another 1,300 people with AIDS require on-going medical attention. Another 50,000 people are believed to be infected with the AIDS virus. Within four years, city health officials project, up to 5,000 city residents will be living with AIDS, more than one-tenth of whom will need hospital care at any one time. Some doctors believe even these staggering projections may be too low.

The AIDS virus cripples the body's immune system, spawning a host of opportunistic infections and cancers that ravage and ultimately destroy the body. A variety of intravenous drug therapies, blood transfusions and other treatment are available to combat these infections. Doctors here have found that, for the most part, many of these can be offered at one of several clinics in the city or even in the home.

"AIDS is essentially an outpatient disease," said Dr. Donald Abrams, codirector of the AIDS division at San Francisco General, the city's public hospital, whose Ward 86 has become a huge outpatient clinic for AIDS patients. Noting that he was once disposed to hospitalize at the first sign of pneumocystis pneumonia, another common AIDS infection, Abrams said he is "more inclined to want people at home. The more people can stay at home, the more it increases quality of life."

"Early in the epidemic, patients tended to die in the intensive care unit on respirators. Doctors tried to pull out all the stops, and people died pretty inhumane deaths," said Dr. Jerome Schofferman, medical director of the city's major hospice. "But as more and more people saw friends die, they decided, why don't we let them die at home."

Often, it is the patients who insist they be able to receive treatment at home.

John Petuya, a retired mortgage banker was diagnosed with AIDS in 1986, shortly after returning from a vacation in Europe. Before his death last month at 47 years old, Petuya and Don Sheppard, who lived with him for 18 years, talked at length about fighting the disease on home ground -- their yellow stucco house in the San Francisco suburb of Hayward.

Though the disease forced Petuya into the hospital twice, for the most part he was able to remain at home, despite a host of complications ranging from diarrhea, dizziness and dementia to pneumonia and a potentially blinding eye disease called CMV retinitis. A home nursing agency delivered Petuya's medications weekly, while Sheppard tended to his personal needs.

"I was scared, and I talked to Don and we discussed the burden," Petuya said. "It really wasn't a burden for him. I didn't want to go to the hospital. I wanted to be at home with Don and have Don take care of me."

For an hour a day, five days a week, Sheppard would attach intravenous tubing to a hat rack next to Petuya's bed and administer the required dosage of ganciclovir, an experimental drug to treat Petuya's retinitis. Twice a week, he drew blood for testing by a local hospital, which in turn sent the results to Petuya's physician, William Owen, one of San Francisco's most prominent AIDS doctors. Once a month, Sheppard, who also is a retired mortgage banker, drove Petuya an hour into the city for a checkup.

Owen was intially skeptical about the arrangement, but gradually became convinced because of his complete trust in Sheppard, who devoted virtually his whole day to caring for Petuya -- from cooking and cleaning to ensuring that the catheter offering a direct line into his blood stream was kept clean.

"In the past, much of this would have required hospitalization," Owen said before Petuya died. "But I have a lot of confidence in Don's ability to take my orders, and I think we'll be able to get through this."

Looking back, Sheppard has no regrets.

"The treatment he got was the best he could have possibly received . . . , " Sheppard said. "He wanted to be at home. I wanted him to be at home. It just worked better at home."Home Care Is Much Cheaper

The cost of home care can be as much as 75 percent less than the $800 to $1,000 it costs to be in the hospital for a day. As AIDS has mushroomed in San Francisco, doctors have detected much more willingness on the part of insurers to pay for different types of care, even when it is not formally part of a patient's benefits package.

Many AIDS patients exhaust their private insurance during the course of the illness and are forced onto the rolls of Medicaid, the federal-state insurance program for the poor, which covers roughly 12 percent of the entire population but an estimated 40 percent of all AIDS patients. Too sick to work, many AIDS patients quickly run through their savings.

It is a process that Petuya learned all too well; his insurance ran out in August and he was forced to "spend down" most of his assets to reach Medicaid eligibility limits. But while he could rely on housing and support from Sheppard, hundreds of other people with AIDS here turn to the services offered by a variety of private agencies in the city. It is the existence of these support services that doctors say gives them the confidence to discharge their patients from the hospital earlier.

Perhaps the best-known suppport group is the Shanti project, an organization founded in 1974 to deal with the problems of the dying and that has focused on AIDS exclusively since 1983. Shanti officials estimate that more than 80 percent of AIDS patients in the city approach the group for help.

Shanti's services are varied. The project's residence program maintains 12 houses, and the 47 people with AIDS who live in them are asked to contribute up to one-quarter of their income as rent. Shanti volunteers help AIDS patients with cooking, cleaning and shopping, and drive them to medical appointments. Counselors work on a one-to-one basis with any AIDS patient in need of emotional support.

"We encourage people to let their feelings out," said Grey Day, Shanti's community relations director. "Whatever they are, we validate them. We are a nonjudgmental organization."

While the group's administrative staff and $3.2 million budget have increased sharply within the past five years, Shanti continues to rely on a cadre of volunteers trained in issues of death and dying and committed to at least eight hours of work a week. Shanti has more than 700 volunteers, who in the last year provided nearly 200,000 hours of unpaid service that Chris Sandoval, assistant director, estimates would cost $8 million annually on the open market.

Shanti is far from alone. The San Francisco AIDS Foundation carries out much of the AIDS education and prevention services for the city. It also runs a food bank with staple items for AIDS and AIDS-related complex (ARC) patients and provides short-term housing as well. Another group, the AIDS emergency fund, makes direct cash grants to AIDS patients earning less than $700 a month. An AIDS legal defense panel consisting of 200 volunteer attorneys provides low-cost or free legal help for AIDS patients, no small job in a city that, despite advances, continues to report incidences of housing and job discrimination against people with AIDS.

A major factor in San Francisco's success has been that the overwhelming majority of people with AIDS -- about 85 percent -- are gay men. San Francisco's gay community of an estimated 80,000 people is politically powerful and relatively affluent, and has responded with an often heroic level of volunteer support for AIDS patients.Help for IV Drug Abusers?

Whether this model would apply to other cities is questionable. Health economists are quick to draw comparisons to New York, where intravenous drug abusers make up a much larger percentage of the city's AIDS cases. A third of the more than 12,000 cases to date in the city come from this risk group, whose members, as a rule, have less private insurance, more complex health problems, and are more difficult and expensive to treat.

"New York is doing a lot, but it is not working as well because the problem is very complicated," said Peter Arno, a professor at Baruch College-Mount Sinai School of Medicine, who has studied both cities' response to the AIDS epidemic. "The San Francisco model cannot just be transplanted everywhere."

Unlike most other cities, the San Francisco model also depends to a very critical degree on funding from city coffers. Direct city funds subsidize care at San Francisco General, the hospital of last resort for indigent AIDS patients, as well as numerous other programs including Shanti, the AIDS Foundation, and Visiting Nurse and Hospice of San Francisco, the major home care agency.

By a coincidental stroke of good luck, San Francisco reported a budget surplus at the time the epidemic hit in the early 1980s, enabling the city to absorb the extra cost of the epidemic without too much difficulty.

In the current fiscal year, the city will spend roughly $13 million of its tax dollars on AIDS activities, or roughly one-tenth of city tax dollars spent by the health department. At the current rate, city spending on AIDS would escalate to almost $70 million in 1991, or more than $100 in taxes for each city resident, according to health department officials.

"The system thus far has been able to respond, yet we're at a point where unless more resources are made available, we're not going to be able to cope with the epidemic in two years," said Lee of the Health Commission. "I don't want to cry wolf, but we're in a crisis situation."

Without increased federal and state funding, officials say, spending on AIDS will start cutting into other health care needs, such as spending for the homeless, the mentally ill or pregnant women. "We're not a very big city. It's not a very big tax base," said David Werdegar, director of the city Department of Public Health. "If the city had to continue to do all of these AIDS programs out of its own pocket, it couldn't do it."

But too few dollars may be the least of the city's worries. Another more troubling question is whether the city's medical and volunteer staff, already stretched thin by the epidemic, can sustain the effort.

Phil Sowa, executive director of San Francisco General, has seen staff burnout first-hand. On any given day, almost 40 AIDS patients are in General, taking up roughly one-quarter of the hospital's medical-surgical beds. Some of the nurses and doctors who have worked by choice in Unit 5A, the inpatient unit for AIDS patients, have been there since the unit opened in 1983. "We've reached a point of saturation," Sowa said.

"You can only go so far with the resources we have," he said. "Many of the people dealing with this epidemic have voluntarily provided their services. Many of the people are gay. Many of the people have seen multiple losses of loved ones and friends. People just get really tired of this and ask when is it going to end.

"We built a model to respond to the epidemic. Now the epidemic is driving the model."