BigQuery: Set up limits and custom quotas through API

BigQuery allows to set custom quotas for limiting cost on too large query. But how to set this limit by API?