Buckets:

rtrm's picture
download
raw
24.8 kB
import{s as Ml,n as ol,o as rl}from"../chunks/scheduler.f6b352c8.js";import{S as pl,i as cl,g as i,s as n,r,A as jl,h as M,f as t,c as a,j as il,u as p,x as o,k as Se,y as yl,a as s,v as c,d as j,t as y,w as h}from"../chunks/index.6149cea3.js";import{C as ee}from"../chunks/CodeBlock.6f146ba5.js";import{H as u,E as hl}from"../chunks/index.f7afb948.js";function ul(Qe){let J,le,K,te,w,se,U,We="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.",ne,d,Ve='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>.',ae,f,ie,g,Pe="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:",Me,m,Re="<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>",oe,I,_e='⚡ <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>.',re,A,pe,C,ze="<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>",ce,x,je,v,Le='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.',ye,T,Fe='<img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/9_Tgf0Tv65srhBirZQMTp.png" style="max-width: 550px; width: 100%;"/>',he,b,ue,$,Ye="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>).",Je,Z,Xe='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.',Te,q,we,G,De='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>.',Ue,H,Ke='For more details about user tokens, check out <a href="https://huggingface.co/docs/hub/en/security-tokens" rel="nofollow">this guide</a>.',de,k,fe,E,Oe="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.",ge,B,me,N,Ie,S,el="In Python, you can use the <code>requests</code> library to make raw requests to the API:",Ae,Q,Ce,W,ll='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>.',xe,V,ve,P,be,R,tl="In JS, you can use the <code>fetch</code> library to make raw requests to the API:",$e,_,Ze,z,sl='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>.',qe,L,Ge,F,He,Y,nl="In this introduction, we’ve covered the basics of Inference Providers. To learn more about this service, check out our guides and API Reference:",ke,X,al='<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>',Ee,D,Be,O,Ne;return w=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"}}),x=new u({props:{title:"Inference Playground",local:"inference-playground",headingTag:"h2"}}),b=new u({props:{title:"Get Started",local:"get-started",headingTag:"h2"}}),q=new u({props:{title:"Authentication",local:"authentication",headingTag:"h3"}}),k=new u({props:{title:"cURL",local:"curl",headingTag:"h3"}}),B=new ee({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}}),N=new u({props:{title:"Python",local:"python",headingTag:"h3"}}),Q=new ee({props:{code:"aW1wb3J0JTIwcmVxdWV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&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}}),V=new ee({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}}),P=new u({props:{title:"JavaScript",local:"javascript",headingTag:"h3"}}),_=new ee({props:{code:"aW1wb3J0JTIwZmV0Y2glMjBmcm9tJTIwJTIybm9kZS1mZXRjaCUyMiUzQiUwQSUwQWNvbnN0JTIwcmVzcG9uc2UlMjAlM0QlMjBhd2FpdCUyMGZldGNoKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGcm91dGVyLmh1Z2dpbmdmYWNlLmNvJTJGbm92aXRhJTJGdjMlMkZvcGVuYWklMkZjaGF0JTJGY29tcGxldGlvbnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMj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AlMjBjb250ZW50JTNBJTIwJTIySG93JTIwbWFueSUyMCdHJ3MlMjBpbiUyMCdodWdnaW5nZmFjZSclM0YlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QpJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTBBKSUzQiUwQWNvbnNvbGUubG9nKGF3YWl0JTIwcmVzcG9uc2UuanNvbigpKSUzQg==",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}}),L=new ee({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}}),F=new u({props:{title:"Next Steps",local:"next-steps",headingTag:"h2"}}),D=new hl({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/index.md"}}),{c(){J=i("meta"),le=n(),K=i("p"),te=n(),r(w.$$.fragment),se=n(),U=i("p"),U.textContent=We,ne=n(),d=i("p"),d.innerHTML=Ve,ae=n(),r(f.$$.fragment),ie=n(),g=i("p"),g.textContent=Pe,Me=n(),m=i("ul"),m.innerHTML=Re,oe=n(),I=i("p"),I.innerHTML=_e,re=n(),r(A.$$.fragment),pe=n(),C=i("ul"),C.innerHTML=ze,ce=n(),r(x.$$.fragment),je=n(),v=i("p"),v.innerHTML=Le,ye=n(),T=i("a"),T.innerHTML=Fe,he=n(),r(b.$$.fragment),ue=n(),$=i("p"),$.innerHTML=Ye,Je=n(),Z=i("p"),Z.innerHTML=Xe,Te=n(),r(q.$$.fragment),we=n(),G=i("p"),G.innerHTML=De,Ue=n(),H=i("p"),H.innerHTML=Ke,de=n(),r(k.$$.fragment),fe=n(),E=i("p"),E.textContent=Oe,ge=n(),r(B.$$.fragment),me=n(),r(N.$$.fragment),Ie=n(),S=i("p"),S.innerHTML=el,Ae=n(),r(Q.$$.fragment),Ce=n(),W=i("p"),W.innerHTML=ll,xe=n(),r(V.$$.fragment),ve=n(),r(P.$$.fragment),be=n(),R=i("p"),R.innerHTML=tl,$e=n(),r(_.$$.fragment),Ze=n(),z=i("p"),z.innerHTML=sl,qe=n(),r(L.$$.fragment),Ge=n(),r(F.$$.fragment),He=n(),Y=i("p"),Y.textContent=nl,ke=n(),X=i("ul"),X.innerHTML=al,Ee=n(),r(D.$$.fragment),Be=n(),O=i("p"),this.h()},l(e){const l=jl("svelte-u9bgzb",document.head);J=M(l,"META",{name:!0,content:!0}),l.forEach(t),le=a(e),K=M(e,"P",{}),il(K).forEach(t),te=a(e),p(w.$$.fragment,e),se=a(e),U=M(e,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1a4io10"&&(U.textContent=We),ne=a(e),d=M(e,"P",{"data-svelte-h":!0}),o(d)!=="svelte-my20pe"&&(d.innerHTML=Ve),ae=a(e),p(f.$$.fragment,e),ie=a(e),g=M(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-3l2dil"&&(g.textContent=Pe),Me=a(e),m=M(e,"UL",{"data-svelte-h":!0}),o(m)!=="svelte-r6lxgx"&&(m.innerHTML=Re),oe=a(e),I=M(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-owiwcw"&&(I.innerHTML=_e),re=a(e),p(A.$$.fragment,e),pe=a(e),C=M(e,"UL",{"data-svelte-h":!0}),o(C)!=="svelte-1hpjin0"&&(C.innerHTML=ze),ce=a(e),p(x.$$.fragment,e),je=a(e),v=M(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-u2apxl"&&(v.innerHTML=Le),ye=a(e),T=M(e,"A",{href:!0,target:!0,"data-svelte-h":!0}),o(T)!=="svelte-1yefxq"&&(T.innerHTML=Fe),he=a(e),p(b.$$.fragment,e),ue=a(e),$=M(e,"P",{"data-svelte-h":!0}),o($)!=="svelte-hl02sf"&&($.innerHTML=Ye),Je=a(e),Z=M(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-7vavmh"&&(Z.innerHTML=Xe),Te=a(e),p(q.$$.fragment,e),we=a(e),G=M(e,"P",{"data-svelte-h":!0}),o(G)!=="svelte-czvqq9"&&(G.innerHTML=De),Ue=a(e),H=M(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-14h1l7k"&&(H.innerHTML=Ke),de=a(e),p(k.$$.fragment,e),fe=a(e),E=M(e,"P",{"data-svelte-h":!0}),o(E)!=="svelte-rx3iua"&&(E.textContent=Oe),ge=a(e),p(B.$$.fragment,e),me=a(e),p(N.$$.fragment,e),Ie=a(e),S=M(e,"P",{"data-svelte-h":!0}),o(S)!=="svelte-1e368qz"&&(S.innerHTML=el),Ae=a(e),p(Q.$$.fragment,e),Ce=a(e),W=M(e,"P",{"data-svelte-h":!0}),o(W)!=="svelte-16da4wg"&&(W.innerHTML=ll),xe=a(e),p(V.$$.fragment,e),ve=a(e),p(P.$$.fragment,e),be=a(e),R=M(e,"P",{"data-svelte-h":!0}),o(R)!=="svelte-y5hdls"&&(R.innerHTML=tl),$e=a(e),p(_.$$.fragment,e),Ze=a(e),z=M(e,"P",{"data-svelte-h":!0}),o(z)!=="svelte-1qnfqp9"&&(z.innerHTML=sl),qe=a(e),p(L.$$.fragment,e),Ge=a(e),p(F.$$.fragment,e),He=a(e),Y=M(e,"P",{"data-svelte-h":!0}),o(Y)!=="svelte-9ernno"&&(Y.textContent=nl),ke=a(e),X=M(e,"UL",{"data-svelte-h":!0}),o(X)!=="svelte-17o95cw"&&(X.innerHTML=al),Ee=a(e),p(D.$$.fragment,e),Be=a(e),O=M(e,"P",{}),il(O).forEach(t),this.h()},h(){Se(J,"name","hf:doc:metadata"),Se(J,"content",Jl),Se(T,"href","https://huggingface.co/playground"),Se(T,"target","blank")},m(e,l){yl(document.head,J),s(e,le,l),s(e,K,l),s(e,te,l),c(w,e,l),s(e,se,l),s(e,U,l),s(e,ne,l),s(e,d,l),s(e,ae,l),c(f,e,l),s(e,ie,l),s(e,g,l),s(e,Me,l),s(e,m,l),s(e,oe,l),s(e,I,l),s(e,re,l),c(A,e,l),s(e,pe,l),s(e,C,l),s(e,ce,l),c(x,e,l),s(e,je,l),s(e,v,l),s(e,ye,l),s(e,T,l),s(e,he,l),c(b,e,l),s(e,ue,l),s(e,$,l),s(e,Je,l),s(e,Z,l),s(e,Te,l),c(q,e,l),s(e,we,l),s(e,G,l),s(e,Ue,l),s(e,H,l),s(e,de,l),c(k,e,l),s(e,fe,l),s(e,E,l),s(e,ge,l),c(B,e,l),s(e,me,l),c(N,e,l),s(e,Ie,l),s(e,S,l),s(e,Ae,l),c(Q,e,l),s(e,Ce,l),s(e,W,l),s(e,xe,l),c(V,e,l),s(e,ve,l),c(P,e,l),s(e,be,l),s(e,R,l),s(e,$e,l),c(_,e,l),s(e,Ze,l),s(e,z,l),s(e,qe,l),c(L,e,l),s(e,Ge,l),c(F,e,l),s(e,He,l),s(e,Y,l),s(e,ke,l),s(e,X,l),s(e,Ee,l),c(D,e,l),s(e,Be,l),s(e,O,l),Ne=!0},p:ol,i(e){Ne||(j(w.$$.fragment,e),j(f.$$.fragment,e),j(A.$$.fragment,e),j(x.$$.fragment,e),j(b.$$.fragment,e),j(q.$$.fragment,e),j(k.$$.fragment,e),j(B.$$.fragment,e),j(N.$$.fragment,e),j(Q.$$.fragment,e),j(V.$$.fragment,e),j(P.$$.fragment,e),j(_.$$.fragment,e),j(L.$$.fragment,e),j(F.$$.fragment,e),j(D.$$.fragment,e),Ne=!0)},o(e){y(w.$$.fragment,e),y(f.$$.fragment,e),y(A.$$.fragment,e),y(x.$$.fragment,e),y(b.$$.fragment,e),y(q.$$.fragment,e),y(k.$$.fragment,e),y(B.$$.fragment,e),y(N.$$.fragment,e),y(Q.$$.fragment,e),y(V.$$.fragment,e),y(P.$$.fragment,e),y(_.$$.fragment,e),y(L.$$.fragment,e),y(F.$$.fragment,e),y(D.$$.fragment,e),Ne=!1},d(e){e&&(t(le),t(K),t(te),t(se),t(U),t(ne),t(d),t(ae),t(ie),t(g),t(Me),t(m),t(oe),t(I),t(re),t(pe),t(C),t(ce),t(je),t(v),t(ye),t(T),t(he),t(ue),t($),t(Je),t(Z),t(Te),t(we),t(G),t(Ue),t(H),t(de),t(fe),t(E),t(ge),t(me),t(Ie),t(S),t(Ae),t(Ce),t(W),t(xe),t(ve),t(be),t(R),t($e),t(Ze),t(z),t(qe),t(Ge),t(He),t(Y),t(ke),t(X),t(Ee),t(Be),t(O)),t(J),h(w,e),h(f,e),h(A,e),h(x,e),h(b,e),h(q,e),h(k,e),h(B,e),h(N,e),h(Q,e),h(V,e),h(P,e),h(_,e),h(L,e),h(F,e),h(D,e)}}}const Jl='{"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 Tl(Qe){return rl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gl extends pl{constructor(J){super(),cl(this,J,Tl,ul,Ml,{})}}export{gl as component};

Xet Storage Details

Size:
24.8 kB
·
Xet hash:
28c53883165d364d3b2b2e2565dde6d8d76d991f4ff47666bbc485aed8b223ef

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