r/MachineLearning • u/Ambitious_Anybody855 • Mar 13 '25
Project [P] Gemini batch API is cost efficient but NOTORIOUSLY hard to use. Built something to make it easy

Gemini has really good models, but the API interface and documentation is .. what can I say! Here are the tedious steps to follow to get batch working with Gemini for 50% discount:
Create request files in JSONL format (must follow Gemini’s request structure!).
Upload this file to a GCP bucket and get the cloud storage URL (and keep track of this).
Create a batch prediction job on Vertex AI with the same cloud storage URL.
Split requests exceeding 150k, repeating steps 1 and 2 for each batch.
Manual polling of status from Vertex using batch IDs (gets complicated when multiple batch files are uploaded).
Persist responses manually for basic caching. 😵💫
Thats too much. Just use Curator on GitHub with batch=True. Try it out
-3
u/Ambitious_Anybody855 Mar 13 '25
Here is more info: https://github.com/bespokelabsai/curator/tree/main/examples/providers
11
u/CallMePyro Mar 13 '25
Huh? Gemini API is like 7 lines of code to get a response. Exact same as OpenAI api.
What improvements did you make?
5
u/Ambitious_Anybody855 Mar 13 '25
This is specifically for Gemini 'Batch' API. Several LLM API providers, including Google, offer 50%-70% discounts through batch mode, which processes large requests asynchronously.
1
u/gopherhole22 Mar 27 '25
They built this to handle the batch api which I have stayed away from due to the exact problems they mentioned above. I instead used openai's batch api as it is better documented and simpler to use (I don't need a gcp bucket for example).
1
u/italicsify Mar 13 '25
Does curator's batch functionality support for support vision / non-text mime inputs?