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.

Updated November 18, 2026By unrestrictedaiagent
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.

  1. 01

    Install with the OpenAI extra. OpenAIModel needs the openai package.

    Terminal
    pip install "smolagents[openai]"
    export SILK_API_KEY=...
  2. 02

    Set api_base. OpenAIModel calls any OpenAI-compatible server at api_base.

    See agent.py above
  3. 03

    Pick an agent type. ToolCallingAgent emits JSON tool calls. CodeAgent writes Python, so run it in a sandbox.

    Terminal
    python agent.py

Which model

The config uses the Silk Compute base URL, which serves both models with a 1,048,576-token context.

Sources

More frameworks