←新闻详情

Hugging Face更新于 10月10日 11:13

Baseten 接入 Hugging Face Inference Providers

Baseten on Hugging Face Inference Providers 🔥

AI 导读

Hugging Face Inference Providers 现已支持 Baseten,用户可通过网页、huggingface_hub >= 1.26.1、JavaScript SDK 及多种 Agent Harness 调用其托管模型。请求可使用供应商 API key 直连并由供应商计费,也可经 Hugging Face 路由且不加价;PRO 用户每月获 $2 推理额度,登录的免费用户享有少量免费配额。

正文

当前显示原文,中文全文译文尚未就绪。

How it works

In the website UI

In your user account settings, you are able to:

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.

Order providers by preference. This applies to the widget and code snippets in the model pages.

As mentioned, there are two modes when calling Inference Providers:

Custom key (calls go directly to the inference provider, using your own API key of the corresponding inference provider)

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)

Model pages showcase third-party inference providers (the ones that are compatible with the current model, sorted by user preference)

From the client SDKs

Baseten is available through the Hugging Face SDKs - huggingface_hub (>= 1.26.1) for Python and @huggingface/inference for JavaScript.

The following examples show how to use the latest DeepSeek V4 Flash through Baseten. Use a Hugging Face token to authenticate - the request will be routed to Baseten automatically.

From your favorite Agent Harness

Hugging Face Inference Providers are integrated in most Agent Harnesses - including Pi, OpenCode, Hermes Agents, OpenClaw, and more. This means you can plug baseten-hosted models straight into your favorite tools without any extra glue 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 JS

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

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 baseten API key you're billed on your baseten account.

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.)

Important Note ‼️ PRO users get $2 worth of Inference credits every month. You can use them across providers. 🔥

We also provide free inference with a small quota for our signed-in free users, but please upgrade to PRO if you can!

Feedback and next steps

We would love to get your feedback! Share your thoughts and/or comments here: https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/49

Models mentioned in this article 3

deepseek-ai/DeepSeek-V4-Flash-0731

Text Generation • 304B • Updated Aug 1 • 4.49M • 4.01k moonshotai/Kimi-K3 Image-Text-to-Text • 2.8T • Updated 30 days ago • 1.27M • 11.6k zai-org/GLM-5.2 Text Generation • 753B • Updated about 1 month ago • 731k • 5.14k Spaces mentioned in this article 1 Running 98 HuggingDiscussions 🏢 98 Discuss and provide feedback on Hugging Face Hub features

More Articles from our Blog

+4

15 April 29, 2026 llms inference-providers scaleway Scaleway on Hugging Face Inference Providers 🔥 +5 25 September 19, 2025 Community Thank you, beautiful work. I’ll take a closer look at it soon! \n","updatedAt":"2026-08-07T15:12:56.129Z","author":{"_id":"6a2ebb9d8e2313029040dff4","avatarUrl":"/avatars/8c99ddbba8805aa7108710ac044448d1.svg","fullname":"Alessandro Pieraccini","name":"AlessandroAle83","type":"user","isPro":false,"isHf":false,"isHfAdmin":false,"isMod":false,"isUserFollowing":false}},"numEdits":0,"identifiedLanguage":{"language":"en","probability":0.8854858875274658},"editors":["AlessandroAle83"],"editorAvatarUrls":["/avatars/8c99ddbba8805aa7108710ac044448d1.svg"],"reactions":[],"isReport":false}}],"status":"open","isReport":false,"pinned":false,"locked":false,"collection":"community_blogs"},"contextAuthors":["alexker-baseten","rolandcrosby-baseten","squidarth","johan-baseten","celinah","sbrandeis","Wauplin","merve"],"primaryEmailConfirmed":false,"discussionRole":0,"acceptLanguages":["en","zh"],"withThread":true,"cardDisplay":false,"repoDiscussionsLocked":false,"hideComments":true}"> AlessandroAle83 Aug 7 Thank you, beautiful work. I’ll take a closer look at it soon!

Reply Edit Preview Upload images, audio, and videos by dragging in the text input, pasting, or clicking here . Tap or paste here to upload images Comment · Sign up or log in to comment

Upvote 35 +23 Models mentioned in this article 3 deepseek-ai/DeepSeek-V4-Flash-0731 Text Generation • 304B • Updated Aug 1 • 4.49M • 4.01k moonshotai/Kimi-K3 Image-Text-to-Text • 2.8T • Updated 30 days ago • 1.27M • 11.6k zai-org/GLM-5.2 Text Generation • 753B • Updated about 1 month ago • 731k • 5.14k Spaces mentioned in this article 1 Running 98 HuggingDiscussions 🏢 98 Discuss and provide feedback on Hugging Face Hub features

来源

Hugging Face