Buckets:

rtrm's picture
download
raw
25.4 kB
import{s as pl,n as cl,o as jl}from"../chunks/scheduler.f6b352c8.js";import{S as hl,i as yl,g as i,s as n,r as o,A as ul,h as M,f as t,c as a,j as ol,u as p,x as r,k as le,y as Tl,a as s,v as c,d as j,t as h,w as y}from"../chunks/index.6149cea3.js";import{C as te}from"../chunks/CodeBlock.6f146ba5.js";import{H as u,E as Jl}from"../chunks/index.f7afb948.js";function wl(Ve){let T,se,O,ne,U,ae,w,Pe='<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"/>',ie,d,_e="Hugging Face Inference Providers simplify and unify how developers access and run machine learning models by offering a unified, flexible interface to multiple serverless inference providers. This new approach extends our previous Serverless Inference API, providing more models, increased performances and better reliability thanks to our inference partners.",Me,g,Re='To learn more about the launch of Inference Providers, check out our <a href="https://huggingface.co/blog/inference-providers" rel="nofollow">announcement blog post</a>.',re,f,oe,m,ze="Inference Providers offers a fast and simple way to explore thousands of models for a variety of tasks. Whether you’re experimenting with ML capabilities or building a new application, this API gives you instant access to high-performing models across multiple domains:",pe,I,Le="<li><strong>Text Generation:</strong> Including large language models and tool-calling prompts, generate and experiment with high-quality responses.</li> <li><strong>Image and Video Generation:</strong> Easily create customized images, including LoRAs for your own styles.</li> <li><strong>Document Embeddings:</strong> Build search and retrieval systems with SOTA embeddings.</li> <li><strong>Classical AI Tasks:</strong> Ready-to-use models for text classification, image classification, speech recognition, and more.</li>",ce,C,Fe='⚡ <strong>Fast and Free to Get Started</strong>: Inference Providers comes with a free-tier and additional included credits for <a href="https://hf.co/subscribe/pro" rel="nofollow">PRO users</a>, as well as <a href="https://huggingface.co/enterprise" rel="nofollow">Enterprise Hub organizations</a>.',je,A,he,x,Ye="<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, Sambanova, 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>💰 Cost-Effective</strong>: No extra markup on provider rates.</li>",ye,v,ue,b,Xe='To get started quickly with <a href="http://huggingface.co/models?inference_provider=all&amp;sort=trending&amp;other=conversational" rel="nofollow">Chat Completion models</a>, use the <a href="https://huggingface.co/playground" rel="nofollow">Inference Playground</a> to easily test and compare models with your prompts.',Te,J,De='<img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/9_Tgf0Tv65srhBirZQMTp.png" style="max-width: 550px; width: 100%;"/>',Je,$,we,Z,Ke="You can use Inference Providers with your preferred tools, such as Python, JavaScript, or cURL. To simplify integration, we offer both a Python SDK (<code>huggingface_hub</code>) and a JavaScript SDK (<code>huggingface.js</code>).",Ue,k,Oe='In this section, we will demonstrate a simple example using <a href="https://huggingface.co/deepseek-ai/DeepSeek-V3-0324" rel="nofollow">deepseek-ai/DeepSeek-V3-0324</a>, a conversational Large Language Model. For the example, we will use <a href="https://novita.ai/" rel="nofollow">Novita AI</a> as Inference Provider.',de,q,ge,G,el='Inference Providers requires passing a user token in the request headers. You can generate a token by signing up on the Hugging Face website and going to the <a href="https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&amp;tokenType=fineGrained" rel="nofollow">settings page</a>. We recommend creating a <code>fine-grained</code> token with the scope to <code>Make calls to Inference Providers</code>.',fe,H,ll='For more details about user tokens, check out <a href="https://huggingface.co/docs/hub/en/security-tokens" rel="nofollow">this guide</a>.',me,E,Ie,B,tl="Let’s start with a cURL command highlighting the raw HTTP request. You can adapt this request to be run with the tool of your choice.",Ce,N,Ae,S,xe,Q,sl="In Python, you can use the <code>requests</code> library to make raw requests to the API:",ve,W,be,V,nl='For convenience, the Python library <code>huggingface_hub</code> provides an <a href="https://huggingface.co/docs/huggingface_hub/guides/inference" rel="nofollow"><code>InferenceClient</code></a> that handles inference for you. Make sure to install it with <code>pip install huggingface_hub</code>.',$e,P,Ze,_,ke,R,al="In JS, you can use the <code>fetch</code> library to make raw requests to the API:",qe,z,Ge,L,il='For convenience, the JS library <code>@huggingface/inference</code> provides an <a href="https://huggingface.co/docs/huggingface.js/inference/classes/InferenceClient" rel="nofollow"><code>InferenceClient</code></a> that handles inference for you. You can install it with <code>npm install @huggingface/inference</code>.',He,F,Ee,Y,Be,X,Ml="In this introduction, we’ve covered the basics of Inference Providers. To learn more about this service, check out our guides and API Reference:",Ne,D,rl='<li><a href="./pricing">Pricing and Billing</a>: everything you need to know about billing</li> <li><a href="./hub-integration">Hub integration</a>: how is Inference Providers integrated with the Hub?</li> <li><a href="./providers">External Providers</a>: everything about providers and how to become an official partner</li> <li><a href="./hub-api">Hub API</a>: high-level API for Inference Providers</li> <li><a href="./tasks/index">API Reference</a>: learn more about the parameters and task-specific settings.</li>',Se,K,Qe,ee,We;return U=new u({props:{title:"Inference Providers",local:"inference-providers",headingTag:"h1"}}),f=new u({props:{title:"Why use Inference Providers?",local:"why-use-inference-providers",headingTag:"h2"}}),A=new u({props:{title:"Key Features",local:"key-features",headingTag:"h2"}}),v=new u({props:{title:"Inference Playground",local:"inference-playground",headingTag:"h2"}}),$=new u({props:{title:"Get Started",local:"get-started",headingTag:"h2"}}),q=new u({props:{title:"Authentication",local:"authentication",headingTag:"h3"}}),E=new u({props:{title:"cURL",local:"curl",headingTag:"h3"}}),N=new te({props:{code:"Y3VybCUyMGh0dHBzJTNBJTJGJTJGcm91dGVyLmh1Z2dpbmdmYWNlLmNvJTJGbm92aXRhJTJGdjMlMkZvcGVuYWklMkZjaGF0JTJGY29tcGxldGlvbnMlMjAlNUMlMEElMjAlMjAlMjAlMjAtSCUyMCUyMkF1dGhvcml6YXRpb24lM0ElMjBCZWFyZXIlMjAlMjRIRl9UT0tFTiUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC1IJTIwJ0NvbnRlbnQtVHlwZSUzQSUyMGFwcGxpY2F0aW9uJTJGanNvbiclMjAlNUMlMEElMjAlMjAlMjAlMjAtZCUyMCclN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJtZXNzYWdlcyUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkhvdyUyMG1hbnklMjBHJTIwaW4lMjBodWdnaW5nZmFjZSUzRiUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm1vZGVsJTIyJTNBJTIwJTIyZGVlcHNlZWslMkZkZWVwc2Vlay12My0wMzI0JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc3RyZWFtJTIyJTNBJTIwZmFsc2UlMEElMjAlMjAlMjAlMjAlN0Qn",highlighted:`curl https://router.huggingface.co/novita/v3/openai/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;deepseek/deepseek-v3-0324&quot;,
&quot;stream&quot;: false
}&#x27;</span>`,wrap:!1}}),S=new u({props:{title:"Python",local:"python",headingTag:"h3"}}),W=new te({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEElMEFBUElfVVJMJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZub3ZpdGElMkZ2MyUyRm9wZW5haSUyRmNoYXQlMkZjb21wbGV0aW9ucyUyMiUwQWhlYWRlcnMlMjAlM0QlMjAlN0IlMjJBdXRob3JpemF0aW9uJTIyJTNBJTIwJTIyQmVhcmVyJTIwaGZfeHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4JTIyJTdEJTBBcGF5bG9hZCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMm1lc3NhZ2VzJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIySG93JTIwbWFueSUyMCdHJ3MlMjBpbiUyMCdodWdnaW5nZmFjZSclM0YlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjJtb2RlbCUyMiUzQSUyMCUyMmRlZXBzZWVrJTJGZGVlcHNlZWstdjMtMDMyNCUyMiUyQyUwQSU3RCUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMucG9zdChBUElfVVJMJTJDJTIwaGVhZGVycyUzRGhlYWRlcnMlMkMlMjBqc29uJTNEcGF5bG9hZCklMEFwcmludChyZXNwb25zZS5qc29uKCklNUIlMjJjaG9pY2VzJTIyJTVEJTVCMCU1RCU1QiUyMm1lc3NhZ2UlMjIlNUQp",highlighted:`<span class="hljs-keyword">import</span> requests
API_URL = <span class="hljs-string">&quot;https://router.huggingface.co/novita/v3/openai/chat/completions&quot;</span>
headers = {<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">&quot;Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;</span>}
payload = {
<span class="hljs-string">&quot;messages&quot;</span>: [
{
<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-string">&quot;model&quot;</span>: <span class="hljs-string">&quot;deepseek/deepseek-v3-0324&quot;</span>,
}
response = requests.post(API_URL, headers=headers, json=payload)
<span class="hljs-built_in">print</span>(response.json()[<span class="hljs-string">&quot;choices&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;message&quot;</span>])`,wrap:!1}}),P=new te({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudCglMEElMjAlMjAlMjAlMjBwcm92aWRlciUzRCUyMm5vdml0YSUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0QlMjJoZl94eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHglMjIlMkMlMEEpJTBBJTBBY29tcGxldGlvbiUyMCUzRCUyMGNsaWVudC5jaGF0LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMmRlZXBzZWVrLWFpJTJGRGVlcFNlZWstVjMtMDMyNCUyMiUyQyUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIySG93JTIwbWFueSUyMCdHJ3MlMjBpbiUyMCdodWdnaW5nZmFjZSclM0YlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEEpJTBBJTBBcHJpbnQoY29tcGxldGlvbi5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient
client = InferenceClient(
provider=<span class="hljs-string">&quot;novita&quot;</span>,
api_key=<span class="hljs-string">&quot;hf_xxxxxxxxxxxxxxxxxxxxxxxx&quot;</span>,
)
completion = client.chat.completions.create(
model=<span class="hljs-string">&quot;deepseek-ai/DeepSeek-V3-0324&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)`,wrap:!1}}),_=new u({props:{title:"JavaScript",local:"javascript",headingTag:"h3"}}),z=new te({props:{code:"aW1wb3J0JTIwZmV0Y2glMjBmcm9tJTIwJTIybm9kZS1mZXRjaCUyMiUzQiUwQSUwQWNvbnN0JTIwcmVzcG9uc2UlMjAlM0QlMjBhd2FpdCUyMGZldGNoKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGcm91dGVyLmh1Z2dpbmdmYWNlLmNvJTJGbm92aXRhJTJGdjMlMkZvcGVuYWklMkZjaGF0JTJGY29tcGxldGlvbnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtZXRob2QlM0ElMjAlMjJQT1NUJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaGVhZGVycyUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMEF1dGhvcml6YXRpb24lM0ElMjAlNjBCZWFyZXIlMjBoZl94eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHglNjAlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJDb250ZW50LVR5cGUlMjIlM0ElMjAlMjJhcHBsaWNhdGlvbiUyRmpzb24lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBib2R5JTNBJTIwSlNPTi5zdHJpbmdpZnkoJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJvdmlkZXIlM0ElMjAlMjJub3ZpdGElMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbCUzQSUyMCUyMmRlZXBzZWVrLWFpJTJGRGVlcFNlZWstVjMtMDMyNCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcm9sZSUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb250ZW50JTNBJTIwJTIySG93JTIwbWFueSUyMCdHJ3MlMjBpbiUyMCdodWdnaW5nZmFjZSclM0YlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QpJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTBBKSUzQiUwQWNvbnNvbGUubG9nKGF3YWl0JTIwcmVzcG9uc2UuanNvbigpKSUzQg==",highlighted:`<span class="hljs-keyword">import</span> fetch <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;node-fetch&quot;</span>;
<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(
<span class="hljs-string">&quot;https://router.huggingface.co/novita/v3/openai/chat/completions&quot;</span>,
{
<span class="hljs-attr">method</span>: <span class="hljs-string">&quot;POST&quot;</span>,
<span class="hljs-attr">headers</span>: {
<span class="hljs-title class_">Authorization</span>: <span class="hljs-string">\`Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\`</span>,
<span class="hljs-string">&quot;Content-Type&quot;</span>: <span class="hljs-string">&quot;application/json&quot;</span>,
},
<span class="hljs-attr">body</span>: <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>({
<span class="hljs-attr">provider</span>: <span class="hljs-string">&quot;novita&quot;</span>,
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;deepseek-ai/DeepSeek-V3-0324&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>(<span class="hljs-keyword">await</span> response.<span class="hljs-title function_">json</span>());`,wrap:!1}}),F=new te({props:{code:"aW1wb3J0JTIwJTdCJTIwSW5mZXJlbmNlQ2xpZW50JTIwJTdEJTIwZnJvbSUyMCUyMiU0MGh1Z2dpbmdmYWNlJTJGaW5mZXJlbmNlJTIyJTNCJTBBJTBBY29uc3QlMjBjbGllbnQlMjAlM0QlMjBuZXclMjBJbmZlcmVuY2VDbGllbnQoJTIyaGZfeHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4JTIyKSUzQiUwQSUwQWNvbnN0JTIwY2hhdENvbXBsZXRpb24lMjAlM0QlMjBhd2FpdCUyMGNsaWVudC5jaGF0Q29tcGxldGlvbiglN0IlMEElMjAlMjAlMjAlMjBwcm92aWRlciUzQSUyMCUyMm5vdml0YSUyMiUyQyUwQSUyMCUyMCUyMCUyMG1vZGVsJTNBJTIwJTIyZGVlcHNlZWstYWklMkZEZWVwU2Vlay1WMy0wMzI0JTIyJTJDJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByb2xlJTNBJTIwJTIydXNlciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNvbnRlbnQlM0ElMjAlMjJIb3clMjBtYW55JTIwJ0cncyUyMGluJTIwJ2h1Z2dpbmdmYWNlJyUzRiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSU3RCklM0IlMEElMEFjb25zb2xlLmxvZyhjaGF0Q29tcGxldGlvbi5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlKSUzQg==",highlighted:`<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>(<span class="hljs-string">&quot;hf_xxxxxxxxxxxxxxxxxxxxxxxx&quot;</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">provider</span>: <span class="hljs-string">&quot;novita&quot;</span>,
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;deepseek-ai/DeepSeek-V3-0324&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>);`,wrap:!1}}),Y=new u({props:{title:"Next Steps",local:"next-steps",headingTag:"h2"}}),K=new Jl({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/index.md"}}),{c(){T=i("meta"),se=n(),O=i("p"),ne=n(),o(U.$$.fragment),ae=n(),w=i("div"),w.innerHTML=Pe,ie=n(),d=i("p"),d.textContent=_e,Me=n(),g=i("p"),g.innerHTML=Re,re=n(),o(f.$$.fragment),oe=n(),m=i("p"),m.textContent=ze,pe=n(),I=i("ul"),I.innerHTML=Le,ce=n(),C=i("p"),C.innerHTML=Fe,je=n(),o(A.$$.fragment),he=n(),x=i("ul"),x.innerHTML=Ye,ye=n(),o(v.$$.fragment),ue=n(),b=i("p"),b.innerHTML=Xe,Te=n(),J=i("a"),J.innerHTML=De,Je=n(),o($.$$.fragment),we=n(),Z=i("p"),Z.innerHTML=Ke,Ue=n(),k=i("p"),k.innerHTML=Oe,de=n(),o(q.$$.fragment),ge=n(),G=i("p"),G.innerHTML=el,fe=n(),H=i("p"),H.innerHTML=ll,me=n(),o(E.$$.fragment),Ie=n(),B=i("p"),B.textContent=tl,Ce=n(),o(N.$$.fragment),Ae=n(),o(S.$$.fragment),xe=n(),Q=i("p"),Q.innerHTML=sl,ve=n(),o(W.$$.fragment),be=n(),V=i("p"),V.innerHTML=nl,$e=n(),o(P.$$.fragment),Ze=n(),o(_.$$.fragment),ke=n(),R=i("p"),R.innerHTML=al,qe=n(),o(z.$$.fragment),Ge=n(),L=i("p"),L.innerHTML=il,He=n(),o(F.$$.fragment),Ee=n(),o(Y.$$.fragment),Be=n(),X=i("p"),X.textContent=Ml,Ne=n(),D=i("ul"),D.innerHTML=rl,Se=n(),o(K.$$.fragment),Qe=n(),ee=i("p"),this.h()},l(e){const l=ul("svelte-u9bgzb",document.head);T=M(l,"META",{name:!0,content:!0}),l.forEach(t),se=a(e),O=M(e,"P",{}),ol(O).forEach(t),ne=a(e),p(U.$$.fragment,e),ae=a(e),w=M(e,"DIV",{class:!0,"data-svelte-h":!0}),r(w)!=="svelte-11agwm4"&&(w.innerHTML=Pe),ie=a(e),d=M(e,"P",{"data-svelte-h":!0}),r(d)!=="svelte-1a4io10"&&(d.textContent=_e),Me=a(e),g=M(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-my20pe"&&(g.innerHTML=Re),re=a(e),p(f.$$.fragment,e),oe=a(e),m=M(e,"P",{"data-svelte-h":!0}),r(m)!=="svelte-3l2dil"&&(m.textContent=ze),pe=a(e),I=M(e,"UL",{"data-svelte-h":!0}),r(I)!=="svelte-r6lxgx"&&(I.innerHTML=Le),ce=a(e),C=M(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-owiwcw"&&(C.innerHTML=Fe),je=a(e),p(A.$$.fragment,e),he=a(e),x=M(e,"UL",{"data-svelte-h":!0}),r(x)!=="svelte-1hpjin0"&&(x.innerHTML=Ye),ye=a(e),p(v.$$.fragment,e),ue=a(e),b=M(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-u2apxl"&&(b.innerHTML=Xe),Te=a(e),J=M(e,"A",{href:!0,target:!0,"data-svelte-h":!0}),r(J)!=="svelte-1yefxq"&&(J.innerHTML=De),Je=a(e),p($.$$.fragment,e),we=a(e),Z=M(e,"P",{"data-svelte-h":!0}),r(Z)!=="svelte-hl02sf"&&(Z.innerHTML=Ke),Ue=a(e),k=M(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-7vavmh"&&(k.innerHTML=Oe),de=a(e),p(q.$$.fragment,e),ge=a(e),G=M(e,"P",{"data-svelte-h":!0}),r(G)!=="svelte-czvqq9"&&(G.innerHTML=el),fe=a(e),H=M(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-14h1l7k"&&(H.innerHTML=ll),me=a(e),p(E.$$.fragment,e),Ie=a(e),B=M(e,"P",{"data-svelte-h":!0}),r(B)!=="svelte-rx3iua"&&(B.textContent=tl),Ce=a(e),p(N.$$.fragment,e),Ae=a(e),p(S.$$.fragment,e),xe=a(e),Q=M(e,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-1e368qz"&&(Q.innerHTML=sl),ve=a(e),p(W.$$.fragment,e),be=a(e),V=M(e,"P",{"data-svelte-h":!0}),r(V)!=="svelte-16da4wg"&&(V.innerHTML=nl),$e=a(e),p(P.$$.fragment,e),Ze=a(e),p(_.$$.fragment,e),ke=a(e),R=M(e,"P",{"data-svelte-h":!0}),r(R)!=="svelte-y5hdls"&&(R.innerHTML=al),qe=a(e),p(z.$$.fragment,e),Ge=a(e),L=M(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-1qnfqp9"&&(L.innerHTML=il),He=a(e),p(F.$$.fragment,e),Ee=a(e),p(Y.$$.fragment,e),Be=a(e),X=M(e,"P",{"data-svelte-h":!0}),r(X)!=="svelte-9ernno"&&(X.textContent=Ml),Ne=a(e),D=M(e,"UL",{"data-svelte-h":!0}),r(D)!=="svelte-17o95cw"&&(D.innerHTML=rl),Se=a(e),p(K.$$.fragment,e),Qe=a(e),ee=M(e,"P",{}),ol(ee).forEach(t),this.h()},h(){le(T,"name","hf:doc:metadata"),le(T,"content",Ul),le(w,"class","flex justify-center"),le(J,"href","https://huggingface.co/playground"),le(J,"target","blank")},m(e,l){Tl(document.head,T),s(e,se,l),s(e,O,l),s(e,ne,l),c(U,e,l),s(e,ae,l),s(e,w,l),s(e,ie,l),s(e,d,l),s(e,Me,l),s(e,g,l),s(e,re,l),c(f,e,l),s(e,oe,l),s(e,m,l),s(e,pe,l),s(e,I,l),s(e,ce,l),s(e,C,l),s(e,je,l),c(A,e,l),s(e,he,l),s(e,x,l),s(e,ye,l),c(v,e,l),s(e,ue,l),s(e,b,l),s(e,Te,l),s(e,J,l),s(e,Je,l),c($,e,l),s(e,we,l),s(e,Z,l),s(e,Ue,l),s(e,k,l),s(e,de,l),c(q,e,l),s(e,ge,l),s(e,G,l),s(e,fe,l),s(e,H,l),s(e,me,l),c(E,e,l),s(e,Ie,l),s(e,B,l),s(e,Ce,l),c(N,e,l),s(e,Ae,l),c(S,e,l),s(e,xe,l),s(e,Q,l),s(e,ve,l),c(W,e,l),s(e,be,l),s(e,V,l),s(e,$e,l),c(P,e,l),s(e,Ze,l),c(_,e,l),s(e,ke,l),s(e,R,l),s(e,qe,l),c(z,e,l),s(e,Ge,l),s(e,L,l),s(e,He,l),c(F,e,l),s(e,Ee,l),c(Y,e,l),s(e,Be,l),s(e,X,l),s(e,Ne,l),s(e,D,l),s(e,Se,l),c(K,e,l),s(e,Qe,l),s(e,ee,l),We=!0},p:cl,i(e){We||(j(U.$$.fragment,e),j(f.$$.fragment,e),j(A.$$.fragment,e),j(v.$$.fragment,e),j($.$$.fragment,e),j(q.$$.fragment,e),j(E.$$.fragment,e),j(N.$$.fragment,e),j(S.$$.fragment,e),j(W.$$.fragment,e),j(P.$$.fragment,e),j(_.$$.fragment,e),j(z.$$.fragment,e),j(F.$$.fragment,e),j(Y.$$.fragment,e),j(K.$$.fragment,e),We=!0)},o(e){h(U.$$.fragment,e),h(f.$$.fragment,e),h(A.$$.fragment,e),h(v.$$.fragment,e),h($.$$.fragment,e),h(q.$$.fragment,e),h(E.$$.fragment,e),h(N.$$.fragment,e),h(S.$$.fragment,e),h(W.$$.fragment,e),h(P.$$.fragment,e),h(_.$$.fragment,e),h(z.$$.fragment,e),h(F.$$.fragment,e),h(Y.$$.fragment,e),h(K.$$.fragment,e),We=!1},d(e){e&&(t(se),t(O),t(ne),t(ae),t(w),t(ie),t(d),t(Me),t(g),t(re),t(oe),t(m),t(pe),t(I),t(ce),t(C),t(je),t(he),t(x),t(ye),t(ue),t(b),t(Te),t(J),t(Je),t(we),t(Z),t(Ue),t(k),t(de),t(ge),t(G),t(fe),t(H),t(me),t(Ie),t(B),t(Ce),t(Ae),t(xe),t(Q),t(ve),t(be),t(V),t($e),t(Ze),t(ke),t(R),t(qe),t(Ge),t(L),t(He),t(Ee),t(Be),t(X),t(Ne),t(D),t(Se),t(Qe),t(ee)),t(T),y(U,e),y(f,e),y(A,e),y(v,e),y($,e),y(q,e),y(E,e),y(N,e),y(S,e),y(W,e),y(P,e),y(_,e),y(z,e),y(F,e),y(Y,e),y(K,e)}}}const Ul='{"title":"Inference Providers","local":"inference-providers","sections":[{"title":"Why use Inference Providers?","local":"why-use-inference-providers","sections":[],"depth":2},{"title":"Key Features","local":"key-features","sections":[],"depth":2},{"title":"Inference Playground","local":"inference-playground","sections":[],"depth":2},{"title":"Get Started","local":"get-started","sections":[{"title":"Authentication","local":"authentication","sections":[],"depth":3},{"title":"cURL","local":"curl","sections":[],"depth":3},{"title":"Python","local":"python","sections":[],"depth":3},{"title":"JavaScript","local":"javascript","sections":[],"depth":3}],"depth":2},{"title":"Next Steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function dl(Ve){return jl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cl extends hl{constructor(T){super(),yl(this,T,dl,wl,pl,{})}}export{Cl as component};

Xet Storage Details

Size:
25.4 kB
·
Xet hash:
b2579504a148408cadd2016438de33995db2d65993a8f430e35b77efe1232c00

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