smolagents with an uncensored model
To run smolagents with an uncensored model, set api_base on OpenAIModel to an endpoint that serves an abliterated model.
agent.pyPython
import os
from smolagents import OpenAIModel, ToolCallingAgent, tool
model = OpenAIModel(
model_id="deepseek-v4.1-flash-1017-uncensored",
api_base="https://api.silkcompute.com",
api_key=os.environ["SILK_API_KEY"],
)
@tool
def list_files(folder: str) -> str:
"""List the files in a local folder.
Args:
folder: Path to the folder.
"""
return "\n".join(os.listdir(folder))
agent = ToolCallingAgent(tools=[list_files], model=model)
agent.run("Which files in ./reports look like old drafts?")- OpenAI format
- OpenAIModel(api_base=)
- Anthropic format
- Not documented
- Tool calling
- ToolCallingAgent, CodeAgent
- Streaming
- stream_outputs=True
- Browser use
- webagent (helium)
- Memory
- agent.memory per run
Labels link to smolagents's own docs, read November 18, 2026. Compare all 11
Point the agent only at systems, files and accounts you own or are allowed to test.
Deploy it
3 steps, with DeepSeek V4.1 Flash 1017.
- 01
Install with the OpenAI extra. OpenAIModel needs the openai package.
Terminalpip install "smolagents[openai]" export SILK_API_KEY=... - 02
Set api_base. OpenAIModel calls any OpenAI-compatible server at api_base.
See agent.py above - 03
Pick an agent type. ToolCallingAgent emits JSON tool calls. CodeAgent writes Python, so run it in a sandbox.
Terminalpython agent.py
Which model
Also fits
Kimi K3.1 Pro
Long runs, image and video input
- Id
kimi-k3.1-pro-uncensored- Per 1M in / out
- $3.50 / $8.00
DeepSeek V4.1 Flash 1017
Value, image input
- Id
deepseek-v4.1-flash-1017-uncensored- Per 1M in / out
- $0.24 / $0.90
The config uses the Silk Compute base URL, which serves both models with a 1,048,576-token context.