To receive SSI you must prove that you are disabled and unable to maintain gainful employment. You can apply directly at the local Social Security Office. HOWEVER, it is recommended to work with a trained SSI advocate (e.g. Conard House South, DEAP, DECU team for CAAP/GA clients, HAP, Positive Resource Center (primarily for those living with HIV/AIDS, although there are now slots for those living with mental health issues and referred by designated Department of Public Health sites).
HINT: If you do not currently receive any treatment for your disability, find a primary care doctor immediately. It is essential to have someone who knows you well and has up-to-date information on your disability. Collect all previous medical records that you can; collect names/contact info for all previous doctors and clinics. The more documentation of your disability you have, the greater chance of your success.
This question was asked on the wiki: San Francisco Homeless Resource.