In this article
Baseten joins Hugging Face Inference Providers
Baseten is now a supported Inference Provider on the Hugging Face Hub.
This integration expands the options for serverless inference directly on model pages. The service connects to client SDKs for JavaScript and Python, allowing developers to run models through their preferred infrastructure with minimal setup.
Baseten offers an infrastructure platform for serverless AI and training. It provides access to a catalog of frontier models, enabling developers to integrate various AI capabilities into applications.
The initial rollout supports conversational and text-generation tasks. Accessible models include Kimi K3, the latest DeepSeek V4 Flash, GLM-5.2, and others. Further task support will follow.
See the full list of supported models here.
Follow Baseten on Hugging Face: https://huggingface.co/baseten.
How the integration works
Using the website UI
- Users can set their own API keys for signed-up providers in account settings. Requests use the Hugging Face key if no custom key is configured.
- Providers can be ordered by preference. This setting affects the widget and code snippets found on model pages.
- Two modes exist for calling Inference Providers:
- Custom key: Requests go directly to the inference provider using your own API key.
- Routed by HF: No provider token is needed, and charges apply directly to your Hugging Face account.
Model pages display compatible third-party inference providers, sorted by user preference.
Using the client SDKs
Baseten is available through the Hugging Face SDKs. Python requires huggingface_hub version 1.26.1 or higher. JavaScript users need @huggingface/inference.
The examples below show how to use the latest DeepSeek V4 Flash through Baseten. Authentication uses a Hugging Face token, which routes requests to Baseten automatically.
From your favorite Agent Harness
Hugging Face Inference Providers integrate into most Agent Harnesses, including Pi, OpenCode, Hermes Agents, OpenClaw, and others. This allows you to plug Baseten-hosted models directly into your tools without extra code. Browse the full list of integrations here.
From Python
import os from openai import OpenAI client = OpenAI( base_url="https://router.huggingface.co/v1", api_key=os.environ["HF_TOKEN"], ) completion = client.chat.completions.create( model="deepseek-ai/DeepSeek-V4-Flash-0731:baseten", messages=[ { "role": "user", "content": "Write a Python function that returns the nth Fibonacci number using memoization." } ], ) print(completion.choices[0].message)
From JavaScript
import { OpenAI } from "openai";
const client = new OpenAI({
baseURL: "https://router.huggingface.co/v1",
apiKey: process.env.HF_TOKEN,
});
const chatCompletion = await client.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4-Flash-0731:baseten",
messages: [
{
role: "user",
content: "Write a Python function that returns the nth Fibonacci number using memoization.",
},
],
});
console.log(chatCompletion.choices[0].message);
Billing
Direct requests, which use an API key from an inference provider, are billed by that provider. Using a Baseten API key charges your Baseten account.
Routed requests, authenticated via the Hugging Face Hub, charge the standard provider API rates. There is no markup; the system passes through provider costs directly. Revenue-sharing agreements with partners may be established later.
PRO users receive $2 worth of Inference credits every month. These credits work across providers.
Free users get a small quota for free inference. Upgrading to PRO is recommended for regular use.
Feedback and next steps
Share your thoughts here: https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49




