Maximum size for O. h is around 66-70 mm - a hair over 2.5 inches. I could not recommend anything smaller than a 10 gal tank and even in this case, longevity will be less than in a larger system. I've kept well over a hundred O. h in the lab and they do well in 20 gal and up. Part of this is probably due to water quality and stability, but it also has to do with activity. O. h are generally found below 50 feet living in burrows that they construct on open, sandy plains. The typical breeding adult will have two or three burrows a meter or two apart. They frequently move from burrow to burrow and use the multiple burrows to escape. With a small footprint of a 5 or 8 gal tank, there just isn't much room to roam.
Also, watch the light intensity. These animals live at sufficient depth that they do not tolerate well bright, broad spectrum light. Bulbs in the blue part of the spectrum are best.
Roy