How do you define the Hochschild (co)homology of a dg category or an A-infinity category? I've only seen it defined when the category is equivalent to a category of modules over a dg algebra; then the Hochschild (co)homology is just that of the algebra. But more generally?

It's the self-Ext algebra of the identity functor from the category to itself. So, for an algebra, this reduces to the self-Ext algebra of the diagonal bimodule, since tensor product with that is the identity functor.

Here's a very explicit answer. You can use a bar complex equally well for $A_{\infty}$ categories and $A_{\infty}$ algebras.

Thus consider $\bigoplus_{k=2}^{\infty} A^{\otimes k}$, put a grading on this as a sum of the number of tensor factors and of the internal gradings (maybe with a shift so we start at $0$), and make this into a complex by defining $d$ to be the sum (with appropriate signs) of all ways to apply an $m_{j}$ (from the original $A_{\infty}$ category) to consecutive tensor factors.

Now take coinvariants and homology.

The appropriate general notion is that of **Drinfeld center**, see http://arxiv.org/abs/0805.0157.

Maybe this answer comes five years too late, but I have recently put an elementary construction of the Hochschild (co)homology of $A_\infty$-algebras on the arXiv: