{"id":6584,"date":"2025-09-12T13:02:55","date_gmt":"2025-09-12T13:02:55","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=6584"},"modified":"2025-09-12T13:02:55","modified_gmt":"2025-09-12T13:02:55","slug":"gemini-batch-api-now-helps-embeddings-and-openai-compatibility","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=6584","title":{"rendered":"Gemini Batch API now helps Embeddings and OpenAI Compatibility"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<h3 data-block-key=\"4dh9d\" id=\"batch-api-now-supports-embeddings-and-openai-compatibility\"><b>Batch API now helps Embeddings and OpenAI Compatibility<\/b><\/h3>\n<p data-block-key=\"bo1ii\">At present we&#8217;re extending the Gemini Batch API to assist the newly launched <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/developers.googleblog.com\/en\/gemini-embedding-available-gemini-api\/\">Gemini Embedding mannequin<\/a> in addition to providing builders the power to leverage the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/googledevai.devsite.corp.google.com\/gemini-api\/docs\/openai\">OpenAI SDK<\/a> to submit and course of batches.<\/p>\n<p data-block-key=\"719d0\">This builds on the preliminary launch of the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/batch-mode\">Gemini Batch API<\/a> &#8211; which permits asynchronous processing at 50% decrease charges for prime quantity and latency tolerant use circumstances.<\/p>\n<\/div>\n<div>\n<h3 data-block-key=\"viqju\" id=\"batch-api-embedding-support\"><b>Batch API Embedding Help<\/b><\/h3>\n<p data-block-key=\"591j4\">Our new Gemini Embedding Mannequin is already getting used for <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/developers.googleblog.com\/en\/gemini-embedding-powering-rag-context-engineering\/\">1000&#8217;s of manufacturing deployments<\/a>. And now, you may leverage the mannequin with the Batch API at a lot larger <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/rate-limits\">price limits<\/a> and at half the value &#8211; $0.075 per 1M enter tokens &#8211; to unlock much more value delicate, latency tolerant, or asynchronous use circumstances.<\/p>\n<p data-block-key=\"1s7i1\">Get began with Batch Embeddings with just a few strains of code:<\/p>\n<\/div>\n<div>\n<pre><code class=\"language-python\"># Create a JSONL along with your requests:&#13;\n# {\"key\": \"request_1\", \"request\": {\"output_dimensionality\": 512, \"content material\": {\"components\": [{\"text\": \"Explain GenAI\"}]}}}&#13;\n# {\"key\": \"request_2\", \"request\": {\"output_dimensionality\": 512, \"content material\": {\"components\": [{\"text\": \"Explain quantum computing\"}]}}}&#13;\n&#13;\nfrom google import genai&#13;\n&#13;\nconsumer = genai.Consumer()&#13;\n&#13;\nuploaded_batch_requests = consumer.recordsdata.add(file='embedding_requests.jsonl')&#13;\n&#13;\nbatch_job = consumer.batches.create_embeddings(&#13;\n    mannequin=\"gemini-embedding-001\",&#13;\n    src={\"file_name\": uploaded_batch_requests.identify}&#13;\n)&#13;\n&#13;\n&#13;\nprint(f\"Created embedding batch job: {batch_job.identify}\")&#13;\n&#13;\n# Look forward to as much as 24 hours&#13;\n&#13;\nif batch_job.state.identify == 'JOB_STATE_SUCCEEDED':&#13;\n    result_file_name = batch_job.dest.file_name&#13;\n    file_content_bytes = consumer.recordsdata.obtain(file=result_file_name)&#13;\n    file_content = file_content_bytes.decode('utf-8')&#13;\n&#13;\n    for line in file_content.splitlines():&#13;\n        print(line)<\/code><\/pre>\n<p>\n        Python\n    <\/p>\n<\/div>\n<div>\n<p data-block-key=\"re7m2\">For extra informations and examples go to:<\/p>\n<\/div>\n<div>\n<h3 data-block-key=\"ircys\" id=\"openai-compatibility-for-batch-api\"><b>OpenAI compatibility for Batch API<\/b><\/h3>\n<p data-block-key=\"272oj\">Switching to Gemini Batch API is now as simple as updating a couple of strains of code if you happen to use the OpenAI SDK compatibility layer:<\/p>\n<\/div>\n<div>\n<pre><code class=\"language-python\">from openai import OpenAI&#13;\n&#13;\nopenai_client = OpenAI(&#13;\n    api_key=\"GEMINI_API_KEY\",&#13;\n    base_url=\"https:\/\/generativelanguage.googleapis.com\/v1beta\/openai\/\"&#13;\n)&#13;\n&#13;\n# Add JSONL file in OpenAI batch enter format...&#13;\n&#13;\n# Create batch&#13;\nbatch = openai_client.batches.create(&#13;\n    input_file_id=batch_input_file_id,&#13;\n    endpoint=\"\/v1\/chat\/completions\",&#13;\n    completion_window=\"24h\"&#13;\n)&#13;\n&#13;\n# Look forward to as much as 24 hours &amp; ballot for standing&#13;\nbatch = openai_client.batches.retrieve(batch.id)&#13;\n&#13;\nif batch.standing == \"accomplished\":&#13;\n    # Obtain outcomes...<\/code><\/pre>\n<p>\n        Python\n    <\/p>\n<\/div>\n<div>\n<p data-block-key=\"re7m2\">You&#8217;ll be able to learn extra concerning the OpenAI Compatibility layer and batch assist in our <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/openai#batch\">documentation<\/a>.<\/p>\n<p data-block-key=\"4p56c\">We&#8217;re repeatedly increasing our batch providing to additional optimize the price of utilizing Gemini API, so hold an eye fixed out for additional updates. Within the meantime, completely happy constructing!<\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Batch API now helps Embeddings and OpenAI Compatibility At present we&#8217;re extending the Gemini Batch API to assist the newly launched Gemini Embedding mannequin in addition to providing builders the power to leverage the OpenAI SDK to submit and course of batches. This builds on the preliminary launch of the Gemini Batch API &#8211; which [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":6586,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[664,5303,5305,5304,295,82,1766],"class_list":["post-6584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-api","tag-batch","tag-compatibility","tag-embeddings","tag-gemini","tag-openai","tag-supports"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6584"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6584\/revisions"}],"predecessor-version":[{"id":6585,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6584\/revisions\/6585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/6586"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69c6f7b5190636d50e9f6768. Config Timestamp: 2026-03-27 21:33:41 UTC, Cached Timestamp: 2026-04-09 11:25:59 UTC -->