{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-17-public-ai-on-hugging-face-inference-providers-fire/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "[![banner image](https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg)](https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg)\n\nWe're thrilled to share that **Public AI** is now a supported Inference Provider on the Hugging Face Hub! Public AI joins our growing ecosystem, enhancing the breadth and capabilities of serverless inference directly on the Hub’s model pages. Inference Providers are also seamlessly integrated into our client SDKs (for both JS and Python), making it super easy to use a wide variety of models with your preferred providers.\n\nThis launch makes it easier than ever to access public and sovereign models from institutions like the Swiss AI Initiative and AI Singapore — right from Hugging Face. You can browse Public AI’s org on the Hub at [https://huggingface.co/publicai](https://huggingface.co/publicai) and try trending supported models at [https://huggingface.co/models?inference_provider=publicai&sort=trending](https://huggingface.co/models?inference_provider=publicai&sort=trending).\n\nThe Public AI Inference Utility is a nonprofit, open-source project. The team builds products and organizes advocacy to support the work of public AI model builders like the Swiss AI Initiative and AI Singapore, among others.\n\nThe Public AI Inference Utility runs on a distributed infrastructure that combines a vLLM-powered backend with a deployment layer designed for resilience across multiple partners. Behind the scenes, inference is handled by servers exposing OpenAI-compatible APIs on vLLM, deployed across clusters donated by national and industry partners. A global load-balancing layer ensures requests are routed efficiently and transparently, regardless of which country’s compute is serving the query.\n\nFree public access is supported by donated GPU time and advertising subsidies, while long-term stability is intended to be anchored by state and institutional contributions. You can learn more about Public AI’s platform and infrastructure at [https://platform.publicai.co/](https://platform.publicai.co/).\n\nYou can now use the Public AI Inference Utility as an Inference Provider on Hugging Face. We're excited to see what you'll build with this new provider.\n\nRead more about how to use Public AI as an Inference Provider in its dedicated [documentation page](https://huggingface.co/docs/inference-providers/providers/publicai).\n\nSee the list of supported models [here](https://huggingface.co/models?inference_provider=publicai&sort=trending).\n\n## How it works\n\n### In the website UI\n\n1. In your user account settings, you are able to:\n\n- Set your own API keys for the providers you’ve signed up with. If no custom key is set, your requests will be routed through HF.\n- Order providers by preference. This applies to the widget and code snippets in the model pages.\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/user-settings-updated.png)\n\n2. As mentioned, there are two modes when calling Inference Providers:\n\n- Custom key (calls go directly to the inference provider, using your own API key of the corresponding inference provider)\n- Routed by HF (in that case, you don't need a token from the provider, and the charges are applied directly to your HF account rather than the provider's account)\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/explainer.png)\n\n3. Model pages showcase third-party inference providers (the ones that are compatible with the current model, sorted by user preference)\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/model-widget-updated.png)\n\n### From the client SDKs\n\n#### from Python, using huggingface\\_hub\n\nThe following example shows how to use Swiss AI's Apertus-70B using Public AI as the inference provider. You can use a [Hugging Face token](https://huggingface.co/settings/tokens) for automatic routing through Hugging Face, or your own Public AI API key if you have one.\n\nNote: this requires using a recent version of `huggingface_hub` (>= 0.34.6).\n\n```python\nimport os\nfrom huggingface_hub import InferenceClient\n\nclient = InferenceClient(\n    provider=\"publicai\",\n    api_key=os.environ[\"HF_TOKEN\"],\n)\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": \"What is the capital of France?\"\n    }\n]\n\ncompletion = client.chat.completions.create(\n    model=\"swiss-ai/Apertus-70B-Instruct-2509\",\n    messages=messages,\n)\n\nprint(completion.choices[0].message)\n```\n\n#### from JS using @huggingface/inference\n\n```js\nimport { InferenceClient } from \"@huggingface/inference\";\n\nconst client = new InferenceClient(process.env.HF_TOKEN);\n\nconst chatCompletion = await client.chatCompletion({\n  model: \"swiss-ai/Apertus-70B-Instruct-2509\",\n  messages: [\n    {\n      role: \"user\",\n      content: \"What is the capital of France?\",\n    },\n  ],\n  provider: \"publicai\",\n});\n\nconsole.log(chatCompletion.choices[0].message);\n```\n\n## Billing\n\nAt the time of writing, usage of the Public AI Inference Utility through Hugging Face Inference Providers is free of charge. Pricing and availability may change.\n\nHere is how billing works for other providers on the platform:\n\nFor direct requests, i.e. when you use the key from an inference provider, you are billed by the corresponding provider. For instance, if you use a Public AI API key you're billed on your Public AI account.\n\nFor routed requests, i.e. when you authenticate via the Hugging Face Hub, you'll only pay the standard provider API rates. There's no additional markup from us; we just pass through the provider costs directly. (In the future, we may establish revenue-sharing agreements with our provider partners.)\n\n**Important Note** ‼️ PRO users get $2 worth of Inference credits every month. You can use them across providers. 🔥\n\nSubscribe to the [Hugging Face PRO plan](https://hf.co/subscribe/pro) to get access to Inference credits, ZeroGPU, Spaces Dev Mode, 20x higher limits, and more.\n\nWe also provide free inference with a small quota for our signed-in free users, but please upgrade to PRO if you can!\n\n## Feedback and next steps\n\nWe would love to get your feedback! Share your thoughts and/or comments here: [https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49](https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49)\n",
  "authors": [],
  "captured_at": "2026-10-04T12:50:30.804479567+00:00",
  "category": "ai",
  "content_html": "<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg\"><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg\" alt=\"banner image\" loading=\"eager\" decoding=\"async\" fetchpriority=\"high\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></a></p>\n<p>We're thrilled to share that <strong>Public AI</strong> is now a supported Inference Provider on the Hugging Face Hub! Public AI joins our growing ecosystem, enhancing the breadth and capabilities of serverless inference directly on the Hub’s model pages. Inference Providers are also seamlessly integrated into our client SDKs (for both JS and Python), making it super easy to use a wide variety of models with your preferred providers.</p>\n<p>This launch makes it easier than ever to access public and sovereign models from institutions like the Swiss AI Initiative and AI Singapore — right from Hugging Face. You can browse Public AI’s org on the Hub at <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/publicai\">https://huggingface.co/publicai</a> and try trending supported models at <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/models?inference_provider=publicai&amp;sort=trending\">https://huggingface.co/models?inference_provider=publicai&amp;sort=trending</a>.</p>\n<p>The Public AI Inference Utility is a nonprofit, open-source project. The team builds products and organizes advocacy to support the work of public AI model builders like the Swiss AI Initiative and AI Singapore, among others.</p>\n<p>The Public AI Inference Utility runs on a distributed infrastructure that combines a vLLM-powered backend with a deployment layer designed for resilience across multiple partners. Behind the scenes, inference is handled by servers exposing OpenAI-compatible APIs on vLLM, deployed across clusters donated by national and industry partners. A global load-balancing layer ensures requests are routed efficiently and transparently, regardless of which country’s compute is serving the query.</p>\n<p>Free public access is supported by donated GPU time and advertising subsidies, while long-term stability is intended to be anchored by state and institutional contributions. You can learn more about Public AI’s platform and infrastructure at <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://platform.publicai.co/\">https://platform.publicai.co/</a>.</p>\n<p>You can now use the Public AI Inference Utility as an Inference Provider on Hugging Face. We're excited to see what you'll build with this new provider.</p>\n<p>Read more about how to use Public AI as an Inference Provider in its dedicated <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/inference-providers/providers/publicai\">documentation page</a>.</p>\n<p>See the list of supported models <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/models?inference_provider=publicai&amp;sort=trending\">here</a>.</p>\n<h2>How it works</h2>\n<h3>In the website UI</h3>\n<ol>\n<li>In your user account settings, you are able to:</li>\n</ol>\n<ul>\n<li>Set your own API keys for the providers you’ve signed up with. If no custom key is set, your requests will be routed through HF.</li>\n<li>Order providers by preference. This applies to the widget and code snippets in the model pages.</li>\n</ul>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/user-settings-updated.png\" alt=\"Inference Providers\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<ol start=\"2\">\n<li>As mentioned, there are two modes when calling Inference Providers:</li>\n</ol>\n<ul>\n<li>Custom key (calls go directly to the inference provider, using your own API key of the corresponding inference provider)</li>\n<li>Routed by HF (in that case, you don't need a token from the provider, and the charges are applied directly to your HF account rather than the provider's account)</li>\n</ul>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/explainer.png\" alt=\"Inference Providers\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<ol start=\"3\">\n<li>Model pages showcase third-party inference providers (the ones that are compatible with the current model, sorted by user preference)</li>\n</ol>\n<p><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/model-widget-updated.png\" alt=\"Inference Providers\" loading=\"lazy\" decoding=\"async\" fetchpriority=\"low\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></p>\n<h3>From the client SDKs</h3>\n<h4>from Python, using huggingface_hub</h4>\n<p>The following example shows how to use Swiss AI's Apertus-70B using Public AI as the inference provider. You can use a <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/settings/tokens\">Hugging Face token</a> for automatic routing through Hugging Face, or your own Public AI API key if you have one.</p>\n<p>Note: this requires using a recent version of <code>huggingface_hub</code> (&gt;= 0.34.6).</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">os</span></span></span>\n<span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-from syntax-python\">from</span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-meta syntax-import-source syntax-python\"> <span class=\"syntax-meta syntax-import-path syntax-python\"><span class=\"syntax-meta syntax-import-name syntax-python\">huggingface_hub</span></span> <span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span></span></span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"> <span class=\"syntax-meta syntax-generic-name syntax-python\">InferenceClient</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">InferenceClient</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n    <span class=\"syntax-variable syntax-parameter syntax-python\">provider</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">publicai<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">api_key</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">os</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">environ</span></span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-begin syntax-python\">[</span></span><span class=\"syntax-meta syntax-item-access syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">HF_TOKEN<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-end syntax-python\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">messages</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-structure syntax-list syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-list syntax-begin syntax-python\">[</span>\n    <span class=\"syntax-meta syntax-structure syntax-dictionary-or-set syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-begin syntax-python\">{</span>\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">role<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">user<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-dictionary-or-set syntax-python\">,</span>\n        <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">content<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-python\">:</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">What is the capital of France?<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n    <span class=\"syntax-punctuation syntax-section syntax-dictionary-or-set syntax-end syntax-python\">}</span></span>\n<span class=\"syntax-punctuation syntax-section syntax-list syntax-end syntax-python\">]</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">completion</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">client</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">chat</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">completions</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">create</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\">\n    <span class=\"syntax-variable syntax-parameter syntax-python\">model</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">swiss-ai/Apertus-70B-Instruct-2509<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n    <span class=\"syntax-variable syntax-parameter syntax-python\">messages</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">messages</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span>\n</span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">completion</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">choices</span></span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-begin syntax-python\">[</span></span><span class=\"syntax-meta syntax-item-access syntax-arguments syntax-python\"><span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">0</span></span><span class=\"syntax-meta syntax-item-access syntax-python\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-end syntax-python\">]</span></span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span><span class=\"syntax-meta syntax-generic-name syntax-python\">message</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n</span></span></code></pre>\n<h4>from JS using @huggingface/inference</h4>\n<pre><code class=\"language-js\"><span class=\"code-snippet\" data-language=\"JavaScript\"><span class=\"syntax-source syntax-js\"><span class=\"syntax-meta syntax-import syntax-js\"><span class=\"syntax-keyword syntax-control syntax-import-export syntax-js\">import</span> <span class=\"syntax-meta syntax-block syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">{</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-js\">InferenceClient</span> <span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">}</span></span> <span class=\"syntax-keyword syntax-control syntax-import-export syntax-js\">from</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-js\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-js\">&quot;</span>@huggingface/inference<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-js\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-terminator syntax-statement syntax-js\">;</span>\n\n<span class=\"syntax-storage syntax-type syntax-js\">const</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-js\">client</span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-js\">=</span> <span class=\"syntax-meta syntax-instance syntax-constructor syntax-js\"><span class=\"syntax-keyword syntax-operator syntax-word syntax-new syntax-js\">new</span><span class=\"syntax-meta syntax-function-call syntax-constructor syntax-js\"> <span class=\"syntax-variable syntax-type syntax-js\">InferenceClient</span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">(</span><span class=\"syntax-support syntax-type syntax-object syntax-process syntax-js\">process</span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-support syntax-type syntax-object syntax-process syntax-js\">env</span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-meta syntax-property syntax-object syntax-js\">HF_TOKEN</span></span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">)</span></span></span></span><span class=\"syntax-punctuation syntax-terminator syntax-statement syntax-js\">;</span>\n\n<span class=\"syntax-storage syntax-type syntax-js\">const</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-js\">chatCompletion</span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-js\">=</span> <span class=\"syntax-variable syntax-other syntax-readwrite syntax-js\">await</span> <span class=\"syntax-variable syntax-other syntax-object syntax-js\">client</span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-meta syntax-function-call syntax-method syntax-js\"><span class=\"syntax-variable syntax-function syntax-js\">chatCompletion</span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">(</span><span class=\"syntax-meta syntax-object-literal syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">{</span>\n  <span class=\"syntax-meta syntax-object-literal syntax-key syntax-js\">model</span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-js\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-js\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-js\">&quot;</span>swiss-ai/Apertus-70B-Instruct-2509<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-js\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n  <span class=\"syntax-meta syntax-object-literal syntax-key syntax-js\">messages</span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-js\">:</span> <span class=\"syntax-meta syntax-sequence syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-js\">[</span>\n    <span class=\"syntax-meta syntax-object-literal syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">{</span>\n      <span class=\"syntax-meta syntax-object-literal syntax-key syntax-js\">role</span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-js\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-js\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-js\">&quot;</span>user<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-js\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n      <span class=\"syntax-meta syntax-object-literal syntax-key syntax-js\">content</span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-js\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-js\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-js\">&quot;</span>What is the capital of France?<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-js\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n    <span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">}</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n  <span class=\"syntax-punctuation syntax-section syntax-brackets syntax-js\">]</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n  <span class=\"syntax-meta syntax-object-literal syntax-key syntax-js\">provider</span><span class=\"syntax-punctuation syntax-separator syntax-key-value syntax-js\">:</span> <span class=\"syntax-string syntax-quoted syntax-double syntax-js\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-js\">&quot;</span>publicai<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-js\">&quot;</span></span><span class=\"syntax-punctuation syntax-separator syntax-comma syntax-js\">,</span>\n<span class=\"syntax-punctuation syntax-section syntax-block syntax-js\">}</span></span></span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">)</span></span></span><span class=\"syntax-punctuation syntax-terminator syntax-statement syntax-js\">;</span>\n\n<span class=\"syntax-meta syntax-function-call syntax-method syntax-js\"><span class=\"syntax-support syntax-type syntax-object syntax-console syntax-js\">console</span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-support syntax-function syntax-console syntax-js\">log</span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">(</span><span class=\"syntax-variable syntax-other syntax-object syntax-js\">chatCompletion</span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-meta syntax-property syntax-object syntax-js\">choices</span><span class=\"syntax-meta syntax-brackets syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-js\">[</span><span class=\"syntax-constant syntax-numeric syntax-js\">0</span><span class=\"syntax-punctuation syntax-section syntax-brackets syntax-js\">]</span></span><span class=\"syntax-punctuation syntax-accessor syntax-js\">.</span><span class=\"syntax-meta syntax-property syntax-object syntax-js\">message</span></span><span class=\"syntax-meta syntax-group syntax-js\"><span class=\"syntax-punctuation syntax-section syntax-group syntax-js\">)</span></span></span><span class=\"syntax-punctuation syntax-terminator syntax-statement syntax-js\">;</span>\n</span></span></code></pre>\n<h2>Billing</h2>\n<p>At the time of writing, usage of the Public AI Inference Utility through Hugging Face Inference Providers is free of charge. Pricing and availability may change.</p>\n<p>Here is how billing works for other providers on the platform:</p>\n<p>For direct requests, i.e. when you use the key from an inference provider, you are billed by the corresponding provider. For instance, if you use a Public AI API key you're billed on your Public AI account.</p>\n<p>For routed requests, i.e. when you authenticate via the Hugging Face Hub, you'll only pay the standard provider API rates. There's no additional markup from us; we just pass through the provider costs directly. (In the future, we may establish revenue-sharing agreements with our provider partners.)</p>\n<p><strong>Important Note</strong> ‼️ PRO users get $2 worth of Inference credits every month. You can use them across providers. 🔥</p>\n<p>Subscribe to the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://hf.co/subscribe/pro\">Hugging Face PRO plan</a> to get access to Inference credits, ZeroGPU, Spaces Dev Mode, 20x higher limits, and more.</p>\n<p>We also provide free inference with a small quota for our signed-in free users, but please upgrade to PRO if you can!</p>\n<h2>Feedback and next steps</h2>\n<p>We would love to get your feedback! Share your thoughts and/or comments here: <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49\">https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49</a></p>\n",
  "content_markdown": "[![banner image](https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg)](https://huggingface.co/blog/assets/inference-providers/welcome-publicai.jpg)\n\nWe're thrilled to share that **Public AI** is now a supported Inference Provider on the Hugging Face Hub! Public AI joins our growing ecosystem, enhancing the breadth and capabilities of serverless inference directly on the Hub’s model pages. Inference Providers are also seamlessly integrated into our client SDKs (for both JS and Python), making it super easy to use a wide variety of models with your preferred providers.\n\nThis launch makes it easier than ever to access public and sovereign models from institutions like the Swiss AI Initiative and AI Singapore — right from Hugging Face. You can browse Public AI’s org on the Hub at [https://huggingface.co/publicai](https://huggingface.co/publicai) and try trending supported models at [https://huggingface.co/models?inference_provider=publicai&sort=trending](https://huggingface.co/models?inference_provider=publicai&sort=trending).\n\nThe Public AI Inference Utility is a nonprofit, open-source project. The team builds products and organizes advocacy to support the work of public AI model builders like the Swiss AI Initiative and AI Singapore, among others.\n\nThe Public AI Inference Utility runs on a distributed infrastructure that combines a vLLM-powered backend with a deployment layer designed for resilience across multiple partners. Behind the scenes, inference is handled by servers exposing OpenAI-compatible APIs on vLLM, deployed across clusters donated by national and industry partners. A global load-balancing layer ensures requests are routed efficiently and transparently, regardless of which country’s compute is serving the query.\n\nFree public access is supported by donated GPU time and advertising subsidies, while long-term stability is intended to be anchored by state and institutional contributions. You can learn more about Public AI’s platform and infrastructure at [https://platform.publicai.co/](https://platform.publicai.co/).\n\nYou can now use the Public AI Inference Utility as an Inference Provider on Hugging Face. We're excited to see what you'll build with this new provider.\n\nRead more about how to use Public AI as an Inference Provider in its dedicated [documentation page](https://huggingface.co/docs/inference-providers/providers/publicai).\n\nSee the list of supported models [here](https://huggingface.co/models?inference_provider=publicai&sort=trending).\n\n## How it works\n\n### In the website UI\n\n1. In your user account settings, you are able to:\n\n- Set your own API keys for the providers you’ve signed up with. If no custom key is set, your requests will be routed through HF.\n- Order providers by preference. This applies to the widget and code snippets in the model pages.\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/user-settings-updated.png)\n\n2. As mentioned, there are two modes when calling Inference Providers:\n\n- Custom key (calls go directly to the inference provider, using your own API key of the corresponding inference provider)\n- Routed by HF (in that case, you don't need a token from the provider, and the charges are applied directly to your HF account rather than the provider's account)\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/explainer.png)\n\n3. Model pages showcase third-party inference providers (the ones that are compatible with the current model, sorted by user preference)\n\n![Inference Providers](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers/model-widget-updated.png)\n\n### From the client SDKs\n\n#### from Python, using huggingface\\_hub\n\nThe following example shows how to use Swiss AI's Apertus-70B using Public AI as the inference provider. You can use a [Hugging Face token](https://huggingface.co/settings/tokens) for automatic routing through Hugging Face, or your own Public AI API key if you have one.\n\nNote: this requires using a recent version of `huggingface_hub` (>= 0.34.6).\n\n```python\nimport os\nfrom huggingface_hub import InferenceClient\n\nclient = InferenceClient(\n    provider=\"publicai\",\n    api_key=os.environ[\"HF_TOKEN\"],\n)\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": \"What is the capital of France?\"\n    }\n]\n\ncompletion = client.chat.completions.create(\n    model=\"swiss-ai/Apertus-70B-Instruct-2509\",\n    messages=messages,\n)\n\nprint(completion.choices[0].message)\n```\n\n#### from JS using @huggingface/inference\n\n```js\nimport { InferenceClient } from \"@huggingface/inference\";\n\nconst client = new InferenceClient(process.env.HF_TOKEN);\n\nconst chatCompletion = await client.chatCompletion({\n  model: \"swiss-ai/Apertus-70B-Instruct-2509\",\n  messages: [\n    {\n      role: \"user\",\n      content: \"What is the capital of France?\",\n    },\n  ],\n  provider: \"publicai\",\n});\n\nconsole.log(chatCompletion.choices[0].message);\n```\n\n## Billing\n\nAt the time of writing, usage of the Public AI Inference Utility through Hugging Face Inference Providers is free of charge. Pricing and availability may change.\n\nHere is how billing works for other providers on the platform:\n\nFor direct requests, i.e. when you use the key from an inference provider, you are billed by the corresponding provider. For instance, if you use a Public AI API key you're billed on your Public AI account.\n\nFor routed requests, i.e. when you authenticate via the Hugging Face Hub, you'll only pay the standard provider API rates. There's no additional markup from us; we just pass through the provider costs directly. (In the future, we may establish revenue-sharing agreements with our provider partners.)\n\n**Important Note** ‼️ PRO users get $2 worth of Inference credits every month. You can use them across providers. 🔥\n\nSubscribe to the [Hugging Face PRO plan](https://hf.co/subscribe/pro) to get access to Inference credits, ZeroGPU, Spaces Dev Mode, 20x higher limits, and more.\n\nWe also provide free inference with a small quota for our signed-in free users, but please upgrade to PRO if you can!\n\n## Feedback and next steps\n\nWe would love to get your feedback! Share your thoughts and/or comments here: [https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49](https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49)\n",
  "dateCreated": "2026-10-04T12:50:30.804479567+00:00",
  "date_created": "2025-09-17T00:00:00+00:00",
  "date_modified": "2025-09-17T00:00:00+00:00",
  "date_published": "2025-09-17T00:00:00+00:00",
  "description": "We're thrilled to share that Public AI is now a supported Inference Provider on the Hugging Face Hub! Public AI joins our growing ecosystem, enhancing the breadth and capabilities of serverless inference directly on the Hub’s model pages.…",
  "external_url": "https://huggingface.co/blog/inference-providers-publicai",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/huggingface-co/2025/09/2025-09-17-public-ai-on-hugging-face-inference-providers-fire.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/huggingface-co/2025/09/2025-09-17-public-ai-on-hugging-face-inference-providers-fire.md"
  },
  "id": "urn:aggr:item:c0af9ce0f4b5b59e35c1ca904d027a400c7987d8",
  "isBasedOn": {
    "@id": "https://huggingface.co/blog/inference-providers-publicai"
  },
  "mainEntity": {
    "@id": "https://huggingface.co/blog/inference-providers-publicai",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-17-public-ai-on-hugging-face-inference-providers-fire/#webpage"
    },
    "dateModified": "2025-09-17T00:00:00+00:00",
    "datePublished": "2025-09-17T00:00:00+00:00",
    "headline": "Public AI on Hugging Face Inference Providers",
    "timeRequired": "PT4M",
    "url": "https://huggingface.co/blog/inference-providers-publicai",
    "wordCount": 803
  },
  "name": "Archived snapshot: Public AI on Hugging Face Inference Providers",
  "preview": null,
  "reading_minutes": 4,
  "replicated_at": null,
  "source": "huggingface-co",
  "source_name": "Hugging Face - Blog",
  "summary": null,
  "tags": [],
  "temporalCoverage": "2026-10-04T12:50:30.804479567+00:00",
  "title": "Public AI on Hugging Face Inference Providers",
  "url": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-17-public-ai-on-hugging-face-inference-providers-fire/",
  "word_count": 803
}