Buckets:

download
raw
90.9 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Inference Providers&quot;,&quot;local&quot;:&quot;inference-providers&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Setup for Agents&quot;,&quot;local&quot;:&quot;quick-setup-for-agents&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Partners&quot;,&quot;local&quot;:&quot;partners&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Why Choose Inference Providers?&quot;,&quot;local&quot;:&quot;why-choose-inference-providers&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Key Features&quot;,&quot;local&quot;:&quot;key-features&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Getting Started&quot;,&quot;local&quot;:&quot;getting-started&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Inference Playground&quot;,&quot;local&quot;:&quot;inference-playground&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Authentication&quot;,&quot;local&quot;:&quot;authentication&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Quick Start - LLM&quot;,&quot;local&quot;:&quot;quick-start---llm&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Python&quot;,&quot;local&quot;:&quot;python&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;JavaScript&quot;,&quot;local&quot;:&quot;javascript&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;HTTP / cURL&quot;,&quot;local&quot;:&quot;http--curl&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Quick Start - Text-to-Image Generation&quot;,&quot;local&quot;:&quot;quick-start---text-to-image-generation&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Python&quot;,&quot;local&quot;:&quot;python&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;JavaScript&quot;,&quot;local&quot;:&quot;javascript&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Provider Selection&quot;,&quot;local&quot;:&quot;provider-selection&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;API as a Proxy Service&quot;,&quot;local&quot;:&quot;api-as-a-proxy-service&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Client-Side Provider Selection (Inference Clients)&quot;,&quot;local&quot;:&quot;client-side-provider-selection-inference-clients&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Alternative: OpenAI-Compatible Chat Completions Endpoint (Chat Only)&quot;,&quot;local&quot;:&quot;alternative-openai-compatible-chat-completions-endpoint-chat-only&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Choosing the Right Approach&quot;,&quot;local&quot;:&quot;choosing-the-right-approach&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Next Steps&quot;,&quot;local&quot;:&quot;next-steps&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/entry/start.Yrr5IqWF.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/8egz5TIQ.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/D1YZhoAV.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/entry/app.DLm95-7q.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/Bee_Vm2K.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/gYW7_7FM.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/CGX_pgXJ.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/nodes/0._NE7fJvp.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/B5z72ZVn.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/nodes/14.Cl6KxlRZ.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/9o5l2gGg.js" rel="modulepreload">
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/chunks/Buztzg3Y.js" rel="modulepreload">
<!--1ldsu9f--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Inference Providers&quot;,&quot;local&quot;:&quot;inference-providers&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Setup for Agents&quot;,&quot;local&quot;:&quot;quick-setup-for-agents&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Partners&quot;,&quot;local&quot;:&quot;partners&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Why Choose Inference Providers?&quot;,&quot;local&quot;:&quot;why-choose-inference-providers&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Key Features&quot;,&quot;local&quot;:&quot;key-features&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Getting Started&quot;,&quot;local&quot;:&quot;getting-started&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Inference Playground&quot;,&quot;local&quot;:&quot;inference-playground&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Authentication&quot;,&quot;local&quot;:&quot;authentication&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Quick Start - LLM&quot;,&quot;local&quot;:&quot;quick-start---llm&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Python&quot;,&quot;local&quot;:&quot;python&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;JavaScript&quot;,&quot;local&quot;:&quot;javascript&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;HTTP / cURL&quot;,&quot;local&quot;:&quot;http--curl&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Quick Start - Text-to-Image Generation&quot;,&quot;local&quot;:&quot;quick-start---text-to-image-generation&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Python&quot;,&quot;local&quot;:&quot;python&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;JavaScript&quot;,&quot;local&quot;:&quot;javascript&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Provider Selection&quot;,&quot;local&quot;:&quot;provider-selection&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;API as a Proxy Service&quot;,&quot;local&quot;:&quot;api-as-a-proxy-service&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Client-Side Provider Selection (Inference Clients)&quot;,&quot;local&quot;:&quot;client-side-provider-selection-inference-clients&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Alternative: OpenAI-Compatible Chat Completions Endpoint (Chat Only)&quot;,&quot;local&quot;:&quot;alternative-openai-compatible-chat-completions-endpoint-chat-only&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Choosing the Right Approach&quot;,&quot;local&quot;:&quot;choosing-the-right-approach&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Next Steps&quot;,&quot;local&quot;:&quot;next-steps&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/inference-providers/pr_2713/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="inference-providers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#inference-providers"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Inference Providers</span></h1><!--]--><!----> <div class="flex justify-center"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/Inference-providers-banner-light.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/Inference-providers-banner-dark.png"/></div> <p>Hugging Face’s Inference Providers give developers access to hundreds of machine learning models, powered by world-class inference providers. They are also integrated into our client SDKs (for JS and Python), making it easy to explore serverless inference of models on your favorite providers.</p> <!--[1--><h2 class="relative group"><a id="quick-setup-for-agents" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-setup-for-agents"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Quick Setup for Agents</span></h2><!--]--><!----> <p>Using a coding agent? Point it at Inference Providers to run <a href="https://huggingface.co/models?inference_provider=all" rel="nofollow">the latest open models available</a> with a single Hugging Face token. Pick your tool below to jump straight to its setup guide.</p> <div class="grid grid-cols-3 sm:grid-cols-5 gap-3 sm:gap-4 my-6"><a href="./integrations/opencode" class="flex flex-col items-center justify-center gap-2 sm:gap-3 px-3 py-4 sm:px-4 sm:py-6 rounded-xl border border-gray-200 dark:border-gray-800 no-underline transition-none hover:border-gray-300 dark:hover:border-gray-700 hover:shadow-inner"><svg class="h-8 w-8 sm:h-10 sm:w-10" width="40" height="40" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"><rect width="512" height="512" rx="96" fill="#131010"></rect><path d="M320 224V352H192V224H320Z" fill="#5A5858"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M384 416H128V96H384V416ZM320 160H192V352H320V160Z" fill="white"></path></svg> <span class="font-semibold text-center leading-tight text-gray-900 dark:text-gray-100">OpenCode</span></a> <a href="./integrations/pi" class="flex flex-col items-center justify-center gap-2 sm:gap-3 px-3 py-4 sm:px-4 sm:py-6 rounded-xl border border-gray-200 dark:border-gray-800 no-underline transition-none hover:border-gray-300 dark:hover:border-gray-700 hover:shadow-inner"><svg class="text-black dark:text-white h-8 w-8 sm:h-10 sm:w-10" width="40" height="40" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"><path fill="currentColor" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"></path><path fill="currentColor" d="M517.36 400H634.72V634.72H517.36Z"></path></svg> <span class="font-semibold text-center leading-tight text-gray-900 dark:text-gray-100">Pi</span></a> <a href="./integrations/codex" class="flex flex-col items-center justify-center gap-2 sm:gap-3 px-3 py-4 sm:px-4 sm:py-6 rounded-xl border border-gray-200 dark:border-gray-800 no-underline transition-none hover:border-gray-300 dark:hover:border-gray-700 hover:shadow-inner"><svg class="text-black dark:text-white h-8 w-8 sm:h-10 sm:w-10" width="40" height="40" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"><path d="M10.28 5.1a2.5 2.5 0 0 0-.21-2.05 2.52 2.52 0 0 0-2.71-1.21 2.53 2.53 0 0 0-4.29.9 2.5 2.5 0 0 0-1.66 1.21 2.52 2.52 0 0 0 .3 2.96 2.5 2.5 0 0 0 .22 2.04 2.52 2.52 0 0 0 2.72 1.21 2.5 2.5 0 0 0 1.87.84 2.52 2.52 0 0 0 2.4-1.75 2.5 2.5 0 0 0 2-2.73 2.52 2.52 0 0 0-.64-1.43Zm-3.76 5.25c-.43 0-.86-.16-1.2-.44l.06-.03 2-1.15a.33.33 0 0 0 .16-.28V5.64l.84.49a.03.03 0 0 1 .02.02v2.32a1.88 1.88 0 0 1-1.88 1.88ZM2.5 8.63c-.22-.38-.3-.83-.22-1.26l.06.04 1.99 1.15a.32.32 0 0 0 .32 0l2.44-1.4v.96a.03.03 0 0 1-.02.03L5.06 9.3a1.87 1.87 0 0 1-2.56-.68Zm-.53-4.34c.23-.38.58-.67.99-.82v2.36a.32.32 0 0 0 .16.29l2.42 1.4L4.7 8a.03.03 0 0 1-.03 0l-2-1.16a1.88 1.88 0 0 1-.7-2.56v.01Zm6.92 1.6L6.46 4.5 7.3 4a.03.03 0 0 1 .03 0l2.01 1.16a1.87 1.87 0 0 1-.28 3.38V6.17a.33.33 0 0 0-.17-.27Zm.84-1.25-.06-.04-1.99-1.16a.32.32 0 0 0-.33 0l-2.43 1.4v-.97a.03.03 0 0 1 .01-.02l2.01-1.16a1.87 1.87 0 0 1 2.79 1.94ZM4.46 6.36l-.84-.49a.03.03 0 0 1-.02-.02V3.53A1.87 1.87 0 0 1 6.68 2.1l-.06.04-2 1.14a.33.33 0 0 0-.16.29v2.8Zm.46-.99L6 4.75l1.09.62v1.25L6 7.25l-1.09-.63V5.37Z" fill="currentColor"></path></svg> <span class="font-semibold text-center leading-tight text-gray-900 dark:text-gray-100">Codex</span></a> <a href="./integrations/claude-code" class="flex flex-col items-center justify-center gap-2 sm:gap-3 px-3 py-4 sm:px-4 sm:py-6 rounded-xl border border-gray-200 dark:border-gray-800 no-underline transition-none hover:border-gray-300 dark:hover:border-gray-700 hover:shadow-inner"><svg class="h-8 w-8 sm:h-10 sm:w-10" width="40" height="40" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"><g clip-path="url(#quick-setup-claude-clip)"><path d="m2.96 7.65 1.97-1.1.03-.1-.03-.05h-.1l-.33-.02-1.12-.03-.97-.04-.95-.06-.24-.05L1 5.91l.02-.15.2-.13.29.02.63.05.95.06.69.04 1.02.11h.16L5 5.84l-.06-.04-.04-.04-.99-.66-1.06-.7-.56-.41-.3-.2-.15-.2-.07-.42.28-.3.36.03.1.02.37.29.8.61 1.03.77.16.12.06-.04v-.03l-.06-.11-.57-1.02-.6-1.04-.27-.43-.07-.26c-.03-.1-.04-.2-.04-.3l.3-.42L3.8 1l.42.06.17.15.26.59.42.93.64 1.26.2.37.1.35.03.1h.07v-.06l.05-.7.1-.88.1-1.12.03-.32.16-.38.3-.2.25.11.2.29-.03.18-.12.77-.23 1.21-.15.81h.09l.1-.1.41-.54.69-.86.3-.34.36-.38.22-.18h.43l.32.47-.14.49-.44.56-.37.47-.53.71-.33.57.03.04h.08l1.2-.26.63-.11.77-.13.35.16.04.16-.14.34-.82.2-.96.2-1.44.33-.01.01.02.03.64.06.28.02h.68l1.25.09.33.22.2.26-.03.2-.5.26-.7-.16-1.59-.38-.54-.13h-.08v.04l.46.45.83.75 1.05.97.05.24-.13.2-.15-.03-.92-.69-.35-.31-.8-.68h-.06v.08l.19.27.98 1.46.05.45-.07.15-.26.09-.28-.05-.57-.8-.59-.9-.47-.82-.06.04-.28 3.02-.13.15-.3.12-.26-.2-.14-.3.14-.62.16-.8.13-.64.12-.79.07-.26v-.02H5.9l-.6.83-.9 1.22-.73.77-.17.07-.3-.15.03-.28.17-.24 1-1.27.6-.78.38-.46v-.06h-.03L2.72 8.73l-.47.06-.2-.19.02-.3.1-.1.8-.55Z" fill="#D97757"></path></g><defs><clipPath id="quick-setup-claude-clip"><path fill="#fff" transform="translate(1 1)" d="M0 0h10v10H0z"></path></clipPath></defs></svg> <span class="font-semibold text-center leading-tight text-gray-900 dark:text-gray-100">Claude Code</span></a> <a href="./integrations/hermes-agent" class="flex flex-col items-center justify-center gap-2 sm:gap-3 px-3 py-4 sm:px-4 sm:py-6 rounded-xl border border-gray-200 dark:border-gray-800 no-underline transition-none hover:border-gray-300 dark:hover:border-gray-700 hover:shadow-inner"><svg class="text-black dark:text-white h-8 w-8 sm:h-10 sm:w-10" width="40" height="40" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"><path fill="currentColor" d="M6.07.83a3.4 3.4 0 0 1 3 2.14q.16.36.28.73.12.42.2.86l.12.65.21.93a18 18 0 0 0 .4 1.5q.07.29.1.58.04.18.04.36v.38q-.03.27-.1.52-.15.4-.4.71l-.06.07h.01l.05-.02q.14-.09.23-.21.27-.3.42-.66a1.5 1.5 0 0 0 .02-1.27l-.02-.05.05.03q.07.08.13.17.2.33.21.71a1.6 1.6 0 0 1-.86 1.5q-.12.08-.26.13a.3.3 0 0 0-.13.16.2.2 0 0 0-.02.18v.06q-.01.05-.05.07-.05 0-.07-.05l-.02-.1a1 1 0 0 0-.14-.38q-.12-.22-.31-.4a1 1 0 0 0-.39-.22l-.3-.06h-.1l.24.09a2 2 0 0 1 .85.7l.1.2.03.17q0 .04-.02.06-.04.02-.07 0L9.4 11q0-.06-.03-.1a3 3 0 0 0-.62-.72 1 1 0 0 0-.23-.14 1 1 0 0 0-.5-.06q-.13 0-.27.02a1 1 0 0 0-.32.12q-.2.14-.36.3l-.41.46a1 1 0 0 0-.13.23l-.01.03-.01.02h-.16q-.04 0-.03-.03l.03-.14q.04-.21.15-.4.01-.03.05-.03v.02l.02.03q.17-.28.42-.49l.35-.24-.21.06q-.25.09-.48.25-.1.05-.18.14-.28.35-.46.76l-.02.05-.03.03h-.21q-.03 0-.02-.04l.16-.18q.2-.17.34-.38l.04-.06q.16-.2.35-.38l.12-.11.03-.04-.07.01-.04.02-.32.19q-.27.14-.52.3-.19.14-.39.24H5.4c0-.05.06-.08.05-.14l-.04.02-.14.13-.37.41h-.52l.01-.01q.03-.05.04-.12-.06-.02-.09.03l-.06.1h-.06l.08-.12v-.01h-.02l-.23.12-.07.02H2.85v-.03q.14-.1.23-.26a2 2 0 0 0 .29-.74l-.03.04-.15.18a.7.7 0 0 1-.42.2 1 1 0 0 1-.37-.05.6.6 0 0 1-.35-.46c0-.08 0-.08-.08-.1a2 2 0 0 1-.51-.25 1 1 0 0 1-.35-.49 2 2 0 0 1-.07-.53l.01-.05.02.03.04.2q.06.23.22.4a1 1 0 0 0 .4.23q.22.08.46-.01.16-.07.27-.2.2-.22.28-.52v-.05h-.01l-.04.07q-.18.32-.52.49a.7.7 0 0 1-.9-.2 1 1 0 0 1-.15-.4 1 1 0 0 1 0-.39c.02-.19.2-.5.32-.55l-.02.07-.05.15c-.06.2-.04.43.06.61q.09.16.27.2l.14.01q.1 0 .17-.05a1 1 0 0 0 .16-.21q.09-.25.13-.51l.1-.75.04-.3.03-.3.03-.3.01-.17.02-.18.03-.33q0-.04-.04-.07a1 1 0 0 1-.33-.33q-.02-.03-.06-.05a1 1 0 0 0 .2.37q.06.04.11.1h-.03l-.1-.02q-.31-.1-.55-.36-.28-.31-.3-.74-.03-.22 0-.46.05-.38.2-.75l.22-.48q.14-.24.33-.46.34-.36.75-.62a6 6 0 0 1 1.66-.77q.43-.13.86-.18l.3-.03zm-1.18 9.92q-.15.17-.29.38l-.02.04.04-.02.35-.42.02-.05h-.01zm.65-1.55-.13.13-.16.17a.4.4 0 0 1-.16.1l-.2.05h-.07l.03.06.2.31.16.29.07.17q.04.02.09-.02l.37-.18q.15-.06.28-.13l.44-.3.01-.01-.02-.02q-.18-.08-.33-.21l-.22-.18a1 1 0 0 1-.18-.28l-.03-.07zm-2.43.12q-.08.24-.24.43a.6.6 0 0 1-.33.22l-.3.03h-.07l.02.04q.06.09.17.12.1.03.22.01a1 1 0 0 0 .2-.1q.15-.13.24-.31a2 2 0 0 0 .15-.57zm6.5-2.1.02.04.03.2.03.28q.02.23 0 .45l-.05.4a3 3 0 0 1-.2.7l.03-.03.11-.1a1.4 1.4 0 0 0 .32-1.12 4 4 0 0 0-.26-.81l-.01-.02zM3.12 4.4v.07l.17.32q.03.03.01.07-.18.03-.38.11l.06.04q.04.01.04.05l-.05.03.03.02q.11.06.19.16.1.12.08.27a.7.7 0 0 1-.3.5l-.07.04-.03.05-.01.06.02.08q.06.13.17.22l.1.1a.2.2 0 0 1 0 .17l-.03.06q-.02.04 0 .07l.06.06q.01.04.06.03.08-.03.14 0 .1.02.2.08l.21.11h.05q.05-.01.07.03.01.05-.04.06l-.09.04q-.06.02-.13.03.02-.04.05-.07c-.09-.05-.28-.06-.34-.01q.03.08-.04.13c-.06-.04-.02-.08 0-.12h-.04l-.06.03-.01.04c0 .04.03.1.07.1l.15-.01h.08q-.07.06-.15.08c0 .02.03.04 0 .06q-.02.02-.05-.01l-.1-.09a.2.2 0 0 1-.07-.13q0-.04-.02-.08-.02-.05.02-.08l-.02-.03-.09-.16q-.03-.09.02-.16l.03-.05.02-.07q0-.1-.08-.17a1 1 0 0 1-.2-.23l-.01-.02-.01.02-.02.24q0 .24.07.48.08.26.2.5l.45.77a.4.4 0 0 0 .3.12q.14 0 .27-.02.19-.01.38-.05l.24-.03q.13-.01.22.1a2 2 0 0 1 .43.58q.03.06.07.01l.17-.15q.04-.04.03-.1a2 2 0 0 1-.03-.54l.02-.29.16-1 .12-.63.1-.8-.01-.53c-.01-.07 0-.07-.07-.09l-.26-.04q-.1 0-.1-.09 0-.03-.02-.06l-.01-.04-.02.12q.01.05-.05.05h-.69q-.06.02-.1-.04L4.6 4.7q-.03-.05-.08-.02l-.25.09q-.15.06-.3.17L3.84 5h-.06l.02-.06.1-.13.02-.04v-.01l-.09.01q-.1.02-.19.06-.08.02-.17-.03-.18-.15-.31-.34zm3.64 3.9-.4.26q-.05.05-.03.12l.06.13q.03.04.1.06h.14q.14-.06.23-.16a.1.1 0 0 0 .04-.13l-.06-.24-.01-.07zm-.18-.68-.2.57h.04l.34-.22q.03-.01.02-.05l-.01-.17-.03-.39-.01-.13H6.7q-.08.18-.14.4m1.47-3.9.04.12.1.31.25.84.47 1.66.06.28q0 .07.03.14l-.02-.16-.05-.28-.02-.09-.12-.51-.27-.88-.3-1.01-.06-.15-.05-.14zM3.29 7q-.04 0-.06.04a.2.2 0 0 0 .18 0zm-.12-.63q.09-.03.16.06l.02.06q0 .01-.02.02l-.15-.12zm-.34-.37v.05q.04-.02.03-.05 0-.02-.03 0m.04-.5-.02.01v.25l.03.09q.04.09.13.04.03 0 0-.04l-.05-.1c0-.02-.03-.05-.01-.08.02-.04-.04-.06-.03-.09v-.06q0-.03-.03-.03zm1.68-.62.26.1.03.02V5l-.12-.04-.14-.04c-.1-.02-.1-.02-.12 0l.25.06.35.18q.03 0 .05.04t.05.03l.1-.01-.03.04c.03.03.06 0 .1.02-.04.06-.11.04-.15.09l.03.03-.05.04c0 .05-.02.07-.14.1l.02.04-.09.02.03.05h-.1v.06l-.11-.01-.03.05h-.03q-.04-.04-.08 0h-.04l-.03-.02c-.05.04-.05.04-.1 0q-.03.04-.07 0-.05.01-.08 0-.04 0-.06-.03l-.05.02c0-.1-.09-.09-.15-.1q0-.03.04-.03h.07q.1.05.21.07l.26-.01a.5.5 0 0 0 .3-.16L5 5.41l-.01-.05-.17-.1q.03.08-.04.1v.01q.05.06 0 .12l-.1.09a.2.2 0 0 1-.28-.02l-.06-.07c-.03-.04-.03-.04-.01-.1q-.09-.06-.04-.16 0-.03.02-.07l-.04.02a.4.4 0 0 0-.15.17l-.01.02-.03-.02v-.03H4l.03-.07-.02-.02.05-.13-.06.03h-.04v-.04q.1-.17.26-.21.13-.03.25-.02zm-1.67.19a.4.4 0 0 0-.2.05q-.04.02-.02.07l.05.11q.03.07.09.03.08-.03.15-.02.12.02.21.12l.04.03h.01q0-.08-.06-.12-.1-.04-.22-.05h-.1c.1-.08.19-.02.3 0q-.06-.07-.1-.09l-.12-.06q-.04-.01-.03-.07m4.42.14a.4.4 0 0 0-.26.1l-.05.04.1.03.06-.02a.5.5 0 0 1 .39.01q.07.04.16 0l-.02-.03a.4.4 0 0 0-.2-.12Q7.4 5.2 7.3 5.2M4.06 3.68l.1.41q.08.25.2.48l.04.04q.06 0 .1-.03l-.2-.36zm1.03-2.64-.26.01-.3.07-.37.11-.04.03h.03q.27-.05.55-.02.12 0 .24.04.3.07.55.24a2.7 2.7 0 0 1 .98 1.15q.21.5.3 1.04 0 .06.07.08.08 0 .1.1 0 .07-.06.11l-.12.15.04-.01.1-.12q.06-.06.06-.14V3.8q.02-.07-.05-.07h-.04q-.05 0-.05-.06-.04-.14.1-.18l.11-.02.2-.02q.1-.02.1.07l.02.04q.02.1-.07.12l-.03.02-.02.03c-.02.06.03.16.09.19l.29.14h.03l-.01-.02-.23-.13-.08-.04-.04-.03-.01-.05a.1.1 0 0 1 .05-.08h.03q.05-.03.05-.09V3.6l-.1-.38q-.12-.46-.35-.87a3 3 0 0 0-.6-.78 2 2 0 0 0-.51-.36 2 2 0 0 0-.75-.17M8 3.6l.02.01zM2.36 2.5l-.01.02-.02.02-.16.15-.11.11a1 1 0 0 0-.24.4l.02.08h.03l-.02.07-.07.21v.04l.1-.21q.18-.45.48-.85v-.01l.01-.02m5.62 1.04zv.02H8zM2.4 2.76l-.07.1q-.03.03-.08.01-.09-.01-.12.06l-.12.25q-.04.06-.05.15h.2l-.04.12-.01.07.04-.07.08-.18q.01-.04.05-.04v.11c.05.02.03.08.04.12.04-.01.04-.09.1-.06v.08h.01l.2-.45q-.09-.01-.16.01h-.05l.1-.2v-.01l.01-.01h-.01l-.01.03-.02.01c-.05.07-.04.07-.1.05q-.05 0-.03-.07l.04-.06zm.9-.29a3 3 0 0 0-.32.48 1 1 0 0 1-.25.2l-.04.01.02-.07.1-.22H2.8l-.04.07c-.11.19-.2.36-.2.41h.04c.08.01.08.01.11-.06a.1.1 0 0 1 .07-.07l.07-.03q.03-.01.06-.01l.01.06q.02.05.02.08l.01.07.02-.04.19-.5q.07-.18.14-.33zm1.73-.1.06.21v.22c-.05-.02-.03-.07-.05-.09H5q0 .05-.02.09l-.1.1q-.03.01-.05-.02l-.02-.04-.07.05-.16.06q-.04.02-.03.06l.03.1q0 .05.05.05.16.02.28.12.03-.06.07-.07l.04-.02q.05 0 .07.03l.03.07c.02-.06-.02-.12 0-.18q.08.12.17.24v-.2l.02-.04q.07.1.1.22v-.17q0-.03.02-.04.04.04.1.07a2 2 0 0 0-.35-.7q-.06-.1-.14-.17zm-1.17.28-.08.24q-.02.06-.08.08L3.59 3h-.05l-.02-.05q-.02.05-.07.03l-.17-.1q-.03-.02-.07 0l-.06.16c-.04.12-.04.1.04.2q.03.01.07 0l.06-.01c.06 0 .12-.03.16 0l.25-.08q.03 0 .05.02 0 .03.03.05c.02-.02 0-.05.03-.07l.06.1-.02-.63zm.13.12q-.05 0-.04.05v.05q.02.13.07.25h.01l.04-.02q.02.04.06.04h.27q.06 0 .09.06 0 .01.03.03l-.03-.17-.07-.26q-.04.03-.08.02l-.06-.01zm4.43-.74q.07.1.06.21.01.11-.02.22l-.05-.03q-.07.01-.1-.05l-.12-.12-.05-.05.04.07.05.09q.03.03.02.08h-.1q-.05-.01-.06.02 0 .05-.07.04l.03.05q.03.05-.01.08l-.08.08-.04.02H7.9l-.29-.07-.04-.03-.03-.06-.06-.09v.21q.02.06-.04.05l-.14-.03-.08.01.03.1h.1q.12.01.2.1l.1.12h.01v-.02c0-.03-.03-.05 0-.08l.04.04.08.11.03.06h.02l-.19-.4h.05l.34.13q.04.01.07-.01l.07-.07q.03-.04.05 0l.11.22.07.14h.01l-.06-.15q-.04-.11-.09-.24.1.04.25.32l.02.03h.01l-.02-.06-.06-.19q-.02-.05 0-.11l.06.02-.01-.08V2.7q.03 0 .04.03l.09.14.02.02c-.02-.1-.09-.17-.1-.27l.06.04q0-.1.02-.2t-.02-.19l.02.01.12.16.03.04.02.03V2.5l-.02-.03-.14-.22q-.14-.2-.21-.22m-2.84.14c0 .07.04.12.03.18l-.16.04q.05.08-.02.14l-.06.08q-.03.02 0 .05l.06.12q.01.03.06.03h.1q.07-.02.11.06l.02.02v-.06q.01-.04.04-.04l.1-.02.03.01.03.03c0-.04-.04-.08-.01-.13l.05.02q-.02-.08-.03-.16t.05-.16q.06.05.1.11.13.17.21.36c.07-.03.12.03.18.04a1 1 0 0 0-.09-.21l-.04-.01-.08.02-.04-.05a2 2 0 0 0-.2-.34l-.1-.1-.17.11q-.03.03-.05 0l-.08-.1z"></path></svg> <span class="font-semibold text-center leading-tight text-gray-900 dark:text-gray-100">Hermes Agent</span></a></div> <!--[1--><h2 class="relative group"><a id="partners" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#partners"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Partners</span></h2><!--]--><!----> <p>Our platform integrates with leading AI infrastructure providers, giving you access to their specialized capabilities through a single, consistent API. Here’s what each partner supports:</p> <table><thead><tr><th>Provider</th><th align="center">Chat completion (LLM)</th><th align="center">Chat completion (VLM)</th><th align="center">Feature Extraction</th><th align="center">Text to Image</th><th align="center">Text to video</th><th align="center">Speech to text</th></tr></thead><tbody><tr><td><a href="./providers/baseten">Baseten</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/cerebras">Cerebras</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/cohere">Cohere</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/deepinfra">DeepInfra</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/fal-ai">Fal AI</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/featherless-ai">Featherless AI</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/fireworks-ai">Fireworks</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/groq">Groq</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/hf-inference">HF Inference</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/novita">Novita</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/nscale">Nscale</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/ovhcloud">OVHcloud AI Endpoints</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/publicai">Public AI</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/replicate">Replicate</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/scaleway">Scaleway</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/together">Together</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/wavespeed">WaveSpeedAI</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr><tr><td><a href="./providers/zai-org">Z.ai</a></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td><td align="center"></td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="why-choose-inference-providers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#why-choose-inference-providers"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Why Choose Inference Providers?</span></h2><!--]--><!----> <p>When you build AI applications, it’s tough to manage multiple provider APIs, comparing model performance, and dealing with varying reliability. Inference Providers solves these challenges by offering:</p> <p><strong>Instant Access to Cutting-Edge Models</strong>: Go beyond mainstream providers to access thousands of specialized models across multiple AI tasks. Whether you need the latest language models, state-of-the-art image generators, or domain-specific embeddings, you’ll find them here.</p> <p><strong>Zero Vendor Lock-in</strong>: Unlike being tied to a single provider’s model catalog, you get access to models from Cerebras, Groq, Together AI, Replicate, and more — all through one consistent interface.</p> <p><strong>Production-Ready Performance</strong>: Built for enterprise workloads with the reliability your applications demand.</p> <p>Here’s what you can build:</p> <ul><li><strong>Text Generation</strong>: Use Large language models with tool-calling capabilities for chatbots, content generation, and code assistance</li> <li><strong>Image and Video Generation</strong>: Create custom images and videos, including support for LoRAs and style customization</li> <li><strong>Search &amp; Retrieval</strong>: State-of-the-art embeddings for semantic search, RAG systems, and recommendation engines</li> <li><strong>Traditional ML Tasks</strong>: Ready-to-use models for classification, NER, summarization, and speech recognition</li></ul> <p><strong>Get Started for Free</strong>: Inference Providers includes a generous free tier, with additional credits for <a href="https://hf.co/subscribe/pro" rel="nofollow">PRO users</a> and <a href="https://huggingface.co/enterprise" rel="nofollow">Team &amp; Enterprise organizations</a>.</p> <!--[1--><h2 class="relative group"><a id="key-features" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#key-features"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Key Features</span></h2><!--]--><!----> <ul><li><strong>🎯 All-in-One API</strong>: A single API for text generation, image generation, document embeddings, NER, summarization, image classification, and more.</li> <li><strong>🔀 Multi-Provider Support</strong>: Easily run models from top-tier providers like fal, Replicate, Together AI, and others.</li> <li><strong>🚀 Scalable &amp; Reliable</strong>: Built for high availability and low-latency performance in production environments.</li> <li><strong>🔧 Developer-Friendly</strong>: Simple requests, fast responses, and a consistent developer experience across Python and JavaScript clients.</li> <li><strong>👷 Easy to integrate</strong>: Drop-in replacement for the OpenAI chat completions API.</li> <li><strong>💰 Cost-Effective</strong>: No extra markup on provider rates.</li></ul> <!--[1--><h2 class="relative group"><a id="getting-started" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#getting-started"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Getting Started</span></h2><!--]--><!----> <p>Inference Providers works with your existing development workflow. Whether you prefer Python, JavaScript, or direct HTTP calls, we provide native SDKs and OpenAI-compatible APIs to get you up and running quickly.</p> <p>We’ll walk through a practical example using <a href="https://huggingface.co/openai/gpt-oss-120b" rel="nofollow">openai/gpt-oss-120b</a>, a state-of-the-art open-weights conversational model.</p> <!--[2--><h3 class="relative group"><a id="inference-playground" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#inference-playground"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Inference Playground</span></h3><!--]--><!----> <p>Before diving into integration, explore models interactively with our <a href="https://huggingface.co/playground" rel="nofollow">Inference Playground</a>. Test different <a href="http://huggingface.co/models?inference_provider=all&amp;sort=trending&amp;other=conversational" rel="nofollow">chat completion models</a> with your prompts and compare responses to find the perfect fit for your use case.</p> <a href="https://huggingface.co/playground" target="blank"><img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/9_Tgf0Tv65srhBirZQMTp.png" alt="Inference Playground thumbnail" style="max-width: 550px; width: 100%;"/></a> <p>Prefer the terminal? Run <code>hf models ls --warm</code> with the <a href="https://huggingface.co/docs/huggingface_hub/package_reference/cli#hf-models-list" rel="nofollow"><code>hf</code> CLI</a> to list every model served by at least one provider, and add <code>--json</code> for scripts and agents. See the <a href="./hub-api">Hub API</a> page for the full set of filters.</p> <!--[2--><h3 class="relative group"><a id="authentication" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#authentication"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Authentication</span></h3><!--]--><!----> <p>You’ll need a Hugging Face token to authenticate your requests. Create one by visiting your <a href="https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&amp;tokenType=fineGrained" rel="nofollow">token settings</a> and generating a <code>fine-grained</code> token with <code>Make calls to Inference Providers</code> permissions.</p> <p>For complete token management details, see our <a href="https://huggingface.co/docs/hub/en/security-tokens" rel="nofollow">security tokens guide</a>.</p> <!--[2--><h3 class="relative group"><a id="quick-start---llm" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-start---llm"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Quick Start - LLM</span></h3><!--]--><!----> <p>Let’s start with the most common use case: conversational AI using large language models. This section demonstrates how to perform chat completions using DeepSeek V3, showcasing the different ways you can integrate Inference Providers into your applications.</p> <p>Whether you prefer our native clients, want OpenAI compatibility, or need direct HTTP access, we’ll show you how to get up and running with just a few lines of code.</p> <!--[3--><h4 class="relative group"><a id="python" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#python"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Python</span></h4><!--]--><!----> <p>Here are three ways to integrate Inference Providers into your Python applications, from high-level convenience to low-level control:</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><!--[--><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">huggingface_hub</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">openai</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">requests</div><!--]--></div> <div class="language-select"><!--[0--><p>For convenience, the <code>huggingface_hub</code> library provides an <a href="https://huggingface.co/docs/huggingface_hub/guides/inference" rel="nofollow"><code>InferenceClient</code></a> that automatically handles provider selection and request routing.</p> <p>In your terminal, install the Hugging Face Hub Python client and log in:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-shell "><!---->pip install huggingface_hub
hf auth login # get a read token from hf.co/settings/tokens<!----></pre></div><!----> <p>You can now use the client with a Python interpreter.</p> <p>By default, our system automatically selects the fastest available provider for the specified model (equivalent to the <code>:fastest</code> policy — highest throughput in tokens per second).</p> <p>You can change the provider selection policy by appending a policy suffix to the model id: <code>:cheapest</code> for the most cost-efficient provider (lowest price per output token), or <code>:preferred</code> to follow your preference order in <a href="https://hf.co/settings/inference-providers" rel="nofollow">Inference Provider settings</a>. For example, <code>openai/gpt-oss-120b:cheapest</code>.</p> <p>You can also select the provider of your choice by appending the provider name to the model id (e.g. <code>"openai/gpt-oss-120b:groq"</code>).</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient
client = InferenceClient()
completion = client.chat.completions.create(
model=<span class="hljs-string">&quot;openai/gpt-oss-120b&quot;</span>,
messages=[
{
<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
<span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;How many &#x27;G&#x27;s in &#x27;huggingface&#x27;?&quot;</span>
}
],
)
<span class="hljs-built_in">print</span>(completion.choices[<span class="hljs-number">0</span>].message)<!----></pre></div><!----><!----><!--]--><!----> <!--[-1--><!--]--><!----> <!--[-1--><!--]--><!----><!----></div><!----> <!--[3--><h4 class="relative group"><a id="javascript" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#javascript"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>JavaScript</span></h4><!--]--><!----> <p>Integrate Inference Providers into your JavaScript applications with these flexible approaches:</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><!--[--><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">huggingface.js</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">openai</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">fetch</div><!--]--></div> <div class="language-select"><!--[0--><p>Our JavaScript SDK provides a convenient interface with automatic provider selection and TypeScript support.</p> <p>Install with NPM:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-shell "><!---->npm install @huggingface/inference<!----></pre></div><!----> <p>Then use the client with Javascript.</p> <p>By default, our system automatically selects the fastest available provider for the specified model (equivalent to the <code>:fastest</code> policy — highest throughput in tokens per second).</p> <p>You can change the provider selection policy by appending a policy suffix to the model id: <code>:cheapest</code> for the most cost-efficient provider (lowest price per output token), or <code>:preferred</code> to follow your preference order in <a href="https://hf.co/settings/inference-providers" rel="nofollow">Inference Provider settings</a>. For example, <code>openai/gpt-oss-120b:cheapest</code>.</p> <p>You can also select the provider of your choice by appending the provider name to the model id (e.g. <code>"openai/gpt-oss-120b:groq"</code>).</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-js "><!----><span class="hljs-keyword">import</span> { <span class="hljs-title class_">InferenceClient</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@huggingface/inference&quot;</span>;
<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">InferenceClient</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>);
<span class="hljs-keyword">const</span> chatCompletion = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">chatCompletion</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fastest&quot;</span>,
<span class="hljs-attr">messages</span>: [
{
<span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>,
<span class="hljs-attr">content</span>: <span class="hljs-string">&quot;How many &#x27;G&#x27;s in &#x27;huggingface&#x27;?&quot;</span>,
},
],
});
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(chatCompletion.<span class="hljs-property">choices</span>[<span class="hljs-number">0</span>].<span class="hljs-property">message</span>);<!----></pre></div><!----><!----><!--]--><!----> <!--[-1--><!--]--><!----> <!--[-1--><!--]--><!----><!----></div><!----> <!--[3--><h4 class="relative group"><a id="http--curl" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#http--curl"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>HTTP / cURL</span></h4><!--]--><!----> <p>For testing, debugging, or integrating with any HTTP client, here’s the raw REST API format.</p> <p>By default, our system automatically selects the fastest available provider for the specified model (equivalent to the <code>:fastest</code> policy — highest throughput in tokens per second).</p> <p>You can change the provider selection policy by appending a policy suffix to the model id: <code>:cheapest</code> for the most cost-efficient provider (lowest price per output token), or <code>:preferred</code> to follow your preference order in <a href="https://hf.co/settings/inference-providers" rel="nofollow">Inference Provider settings</a>. For example, <code>openai/gpt-oss-120b:cheapest</code>.</p> <p>You can also select the provider of your choice by appending the provider name to the model id (e.g. <code>"openai/gpt-oss-120b:groq"</code>).</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->curl https://router.huggingface.co/v1/chat/completions \
-H <span class="hljs-string">&quot;Authorization: Bearer <span class="hljs-variable">$HF_TOKEN</span>&quot;</span> \
-H <span class="hljs-string">&#x27;Content-Type: application/json&#x27;</span> \
-d <span class="hljs-string">&#x27;{
&quot;messages&quot;: [
{
&quot;role&quot;: &quot;user&quot;,
&quot;content&quot;: &quot;How many G in huggingface?&quot;
}
],
&quot;model&quot;: &quot;openai/gpt-oss-120b:fastest&quot;,
&quot;stream&quot;: false
}&#x27;</span><!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="quick-start---text-to-image-generation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-start---text-to-image-generation"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Quick Start - Text-to-Image Generation</span></h3><!--]--><!----> <p>Let’s explore how to generate images from text prompts using Inference Providers. We’ll use <a href="https://huggingface.co/black-forest-labs/FLUX.1-dev" rel="nofollow">black-forest-labs/FLUX.1-dev</a>, a state-of-the-art diffusion model that produces highly detailed, photorealistic images.</p> <!--[3--><h4 class="relative group"><a id="python" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#python"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Python</span></h4><!--]--><!----> <p>Use the <code>huggingface_hub</code> library for the simplest image generation experience with automatic provider selection:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient
client = InferenceClient(api_key=os.environ[<span class="hljs-string">&quot;HF_TOKEN&quot;</span>])
image = client.text_to_image(
prompt=<span class="hljs-string">&quot;A serene lake surrounded by mountains at sunset, photorealistic style&quot;</span>,
model=<span class="hljs-string">&quot;black-forest-labs/FLUX.1-dev&quot;</span>
)
<span class="hljs-comment"># Save the generated image</span>
image.save(<span class="hljs-string">&quot;generated_image.png&quot;</span>)<!----></pre></div><!----> <!--[3--><h4 class="relative group"><a id="javascript" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#javascript"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>JavaScript</span></h4><!--]--><!----> <p>Use our JavaScript SDK for streamlined image generation with TypeScript support:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-js "><!----><span class="hljs-keyword">import</span> { <span class="hljs-title class_">InferenceClient</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@huggingface/inference&quot;</span>;
<span class="hljs-keyword">import</span> fs <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;fs&quot;</span>;
<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">InferenceClient</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>);
<span class="hljs-keyword">const</span> imageBlob = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">textToImage</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;black-forest-labs/FLUX.1-dev&quot;</span>,
<span class="hljs-attr">inputs</span>:
<span class="hljs-string">&quot;A serene lake surrounded by mountains at sunset, photorealistic style&quot;</span>,
});
<span class="hljs-comment">// Save the image</span>
<span class="hljs-keyword">const</span> buffer = <span class="hljs-title class_">Buffer</span>.<span class="hljs-title function_">from</span>(<span class="hljs-keyword">await</span> imageBlob.<span class="hljs-title function_">arrayBuffer</span>());
fs.<span class="hljs-title function_">writeFileSync</span>(<span class="hljs-string">&quot;generated_image.png&quot;</span>, buffer);<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="provider-selection" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#provider-selection"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Provider Selection</span></h2><!--]--><!----> <p>The Inference Providers API acts as a unified proxy layer that sits between your application and multiple AI providers. Understanding how provider selection works is crucial for optimizing performance, cost, and reliability in your applications.</p> <!--[2--><h3 class="relative group"><a id="api-as-a-proxy-service" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#api-as-a-proxy-service"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>API as a Proxy Service</span></h3><!--]--><!----> <p>When using Inference Providers, your requests go through Hugging Face’s proxy infrastructure, which provides several key benefits:</p> <ul><li><strong>Unified Authentication &amp; Billing</strong>: Use a single Hugging Face token for all providers</li> <li><strong>Automatic Failover</strong>: When using automatic provider selection (<code>provider="auto"</code>), requests are automatically routed to alternative providers if the primary provider is flagged as unavailable by our validation system</li> <li><strong>Consistent Interface through client libraries</strong>: When using our client libraries, the same request format works across different providers</li></ul> <p>Because the API acts as a proxy, the exact HTTP request may vary between providers as each provider has their own API requirements and response formats. <strong>When using our official client libraries</strong> (JavaScript or Python), these provider-specific differences are handled automatically whether you use <code>provider="auto"</code> or specify a particular provider.</p> <!--[2--><h3 class="relative group"><a id="client-side-provider-selection-inference-clients" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#client-side-provider-selection-inference-clients"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Client-Side Provider Selection (Inference Clients)</span></h3><!--]--><!----> <p>When using the Hugging Face inference clients (JavaScript or Python), you can explicitly specify a provider or let the system choose automatically. The client then formats the HTTP request to match the selected provider’s API requirements.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><!--[--><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">javascript</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">python</div><!--]--></div> <div class="language-select"><!--[0--><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-javascript "><!----><span class="hljs-keyword">import</span> { <span class="hljs-title class_">InferenceClient</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@huggingface/inference&quot;</span>;
<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">InferenceClient</span>(process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>);
<span class="hljs-comment">// Explicit provider selection</span>
<span class="hljs-keyword">await</span> client.<span class="hljs-title function_">chatCompletion</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;deepseek-ai/DeepSeek-R1&quot;</span>,
<span class="hljs-attr">provider</span>: <span class="hljs-string">&quot;novita&quot;</span>, <span class="hljs-comment">// Specific provider</span>
<span class="hljs-attr">messages</span>: [{ <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;Hello!&quot;</span> }],
});
<span class="hljs-comment">// Automatic provider selection (default: &quot;auto&quot;)</span>
<span class="hljs-keyword">await</span> client.<span class="hljs-title function_">chatCompletion</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;deepseek-ai/DeepSeek-R1&quot;</span>,
<span class="hljs-comment">// Defaults to &quot;auto&quot; selection of the provider</span>
<span class="hljs-comment">// provider=&quot;auto&quot;,</span>
<span class="hljs-attr">messages</span>: [{ <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;Hello!&quot;</span> }],
});<!----></pre></div><!----><!--]--><!----> <!--[-1--><!--]--><!----><!----></div><!----> <p><strong>Provider Selection Policy:</strong></p> <ul><li><code>provider: "auto"</code> (default): Selects the fastest available provider for the model (highest throughput in tokens per second), equivalent to the <code>:fastest</code> policy.</li> <li><code>provider: "specific-provider"</code>: Forces use of a specific provider (e.g., “together”, “replicate”, “fal-ai”, …).</li></ul> <!--[2--><h3 class="relative group"><a id="alternative-openai-compatible-chat-completions-endpoint-chat-only" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#alternative-openai-compatible-chat-completions-endpoint-chat-only"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Alternative: OpenAI-Compatible Chat Completions Endpoint (Chat Only)</span></h3><!--]--><!----> <p>If you prefer to work with familiar OpenAI APIs or want to migrate existing chat completion code with minimal changes, we offer a drop-in compatible endpoint that handles all provider selection automatically on the server side.</p> <p>By default, the fastest available provider is selected for the model (highest throughput in tokens per second). This is equivalent to appending <code>:fastest</code> to the model name.
You can change that policy by adding a suffix to the model name:</p> <ul><li><code>:cheapest</code> selects the most cost-efficient provider for the model (lowest price per output tokens)</li> <li><code>:preferred</code> selects the first available provider sorted by your preference order in <a href="https://hf.co/settings/inference-providers" rel="nofollow">Inference Provider settings</a></li></ul> <p><strong>Note</strong>: This OpenAI-compatible endpoint is currently available for chat completion tasks only. For other tasks like text-to-image, embeddings, or speech processing, use the Hugging Face inference clients shown above.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><!--[--><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">javascript</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">python</div><!--]--></div> <div class="language-select"><!--[0--><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-javascript "><!----><span class="hljs-keyword">import</span> { <span class="hljs-title class_">OpenAI</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;
<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
<span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
<span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});
<span class="hljs-keyword">const</span> completion = <span class="hljs-keyword">await</span> client.<span class="hljs-property">chat</span>.<span class="hljs-property">completions</span>.<span class="hljs-title function_">create</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;deepseek-ai/DeepSeek-R1:fastest&quot;</span>,
<span class="hljs-attr">messages</span>: [{ <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;Hello!&quot;</span> }],
});<!----></pre></div><!----><!--]--><!----> <!--[-1--><!--]--><!----><!----></div><!----> <p>This endpoint can also be requested through direct HTTP access, making it suitable for integration with various HTTP clients and applications that need to interact with the chat completion service directly.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->curl https://router.huggingface.co/v1/chat/completions \
-H <span class="hljs-string">&quot;Authorization: Bearer <span class="hljs-variable">$HF_TOKEN</span>&quot;</span> \
-H <span class="hljs-string">&quot;Content-Type: application/json&quot;</span> \
-d <span class="hljs-string">&#x27;{
&quot;model&quot;: &quot;deepseek-ai/DeepSeek-R1:fastest&quot;,
&quot;messages&quot;: [
{
&quot;role&quot;: &quot;user&quot;,
&quot;content&quot;: &quot;Hello!&quot;
}
]
}&#x27;</span><!----></pre></div><!----> <p><strong>Key Features:</strong></p> <ul><li><strong>Server-Side Provider Selection</strong>: The server automatically selects the fastest available provider by default (<code>:fastest</code> policy)</li> <li><strong>Model Listing</strong>: GET <code>/v1/models</code> returns available models across all providers, including per-provider pricing, context length, latency, and throughput when available</li> <li><strong>OpenAI SDK Compatibility</strong>: Works with existing OpenAI client libraries</li> <li><strong>Chat Tasks Only</strong>: Limited to conversational workloads</li></ul> <!--[2--><h3 class="relative group"><a id="choosing-the-right-approach" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#choosing-the-right-approach"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Choosing the Right Approach</span></h3><!--]--><!----> <p><strong>Use Inference Clients when:</strong></p> <ul><li>You need support for all task types (text-to-image, speech, embeddings, etc.)</li> <li>You want explicit control over provider selection</li> <li>You’re building applications that use multiple AI tasks</li></ul> <p><strong>Use OpenAI-Compatible Endpoint when:</strong></p> <ul><li>You’re only doing chat completions</li> <li>You want to migrate existing OpenAI-based code with minimal changes</li> <li>You prefer server-side provider management</li></ul> <p><strong>Use Direct HTTP when:</strong></p> <ul><li>You’re implementing custom request logic</li> <li>You need fine-grained control over the request/response cycle</li> <li>You’re working in environments without available client libraries</li></ul> <!--[1--><h2 class="relative group"><a id="next-steps" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#next-steps"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Next Steps</span></h2><!--]--><!----> <p>Now that you understand the basics, explore these resources to make the most of Inference Providers:</p> <ul><li><strong><a href="https://huggingface.co/blog/inference-providers" rel="nofollow">Announcement Blog Post</a></strong>: Learn more about the launch of Inference Providers</li> <li><strong><a href="./pricing">Pricing and Billing</a></strong>: Understand costs and billing of Inference Providers</li> <li><strong><a href="./hub-integration">Hub Integration</a></strong>: Learn how Inference Providers are integrated with the Hugging Face Hub</li> <li><strong><a href="./register-as-a-provider">Register as a Provider</a></strong>: Requirements to join our partner network as a provider</li> <li><strong><a href="./hub-api">Hub API</a></strong>: Advanced API features and configuration</li> <li><strong><a href="./tasks/index">API Reference</a></strong>: Complete parameter documentation for all supported tasks</li></ul> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/index.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_1hi8cnu = {
base: "/docs/inference-providers/pr_2713/en",
assets: "/docs/inference-providers/pr_2713/en"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/inference-providers/pr_2713/en/_app/immutable/entry/start.Yrr5IqWF.js"),
import("/docs/inference-providers/pr_2713/en/_app/immutable/entry/app.DLm95-7q.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 14],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
90.9 kB
·
Xet hash:
7b2cf2e3f853d54999876fcc45368b47bfbe15c57b91673a7e561b0ab7ba8d22

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.