smolagents
SDKs & frameworksHugging Face's minimal code-writing agents.
Fill the guide with your values
Stays in this browser tab — never sent or stored by us. Sign in to create one
Setup
- 1Use
OpenAIServerModelwithapi_base=https://api.ultragpt.pro/v1.
# pip install smolagents
import os
from smolagents import CodeAgent, OpenAIServerModel
model = OpenAIServerModel(model_id="grok-4.7", api_base="https://api.ultragpt.pro/v1", api_key=os.environ["ULTRAGPT_API_KEY"])
agent = CodeAgent(tools=[], model=model)
agent.run("What is the 20th Fibonacci number?")Tips
- Any model id from Models works; suffixes like :online (web search) and :nitro work too.
- Give each tool its own key with a spend limit, so usage shows separately in Activity.
- Something off? Error codes · Support