Pydantic AI with an uncensored model
To run Pydantic AI with an uncensored model, wrap an abliterated model id in OpenAIChatModel with an OpenAICompatibleProvider that sets the base URL.
agent.pyPython
import os
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai_compatible import OpenAICompatibleProvider
model = OpenAIChatModel(
"kimi-k3.1-pro-uncensored",
provider=OpenAICompatibleProvider(
"silkcompute",
base_url="https://api.silkcompute.com",
api_key=os.environ["SILK_API_KEY"],
),
)
agent = Agent(model, instructions="Work only on the user's own data.")
@agent.tool_plain
def count_lines(path: str) -> int:
"""Count the lines in a local file."""
return sum(1 for _ in open(path))
print(agent.run_sync("How many lines are in data/leads.csv?").output)- OpenAI format
- OpenAICompatibleProvider
- Anthropic format
- AsyncAnthropic(base_url=)
- Tool calling
- @agent.tool_plain
- Streaming
- agent.run_stream
- Browser use
- Not documented
- Memory
- Message history
Labels link to Pydantic AI'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 Kimi K3.1 Pro.
- 01
Install the slim package. The openai extra brings the OpenAI SDK.
Terminalpip install "pydantic-ai-slim[openai]" export SILK_API_KEY=... - 02
Name the provider. The docs say to keep the provider name stable, since it decides what history goes back.
See agent.py above - 03
Use the Anthropic format instead. Pass your own AsyncAnthropic client to AnthropicProvider.
agent.pyfrom anthropic import AsyncAnthropic from pydantic_ai.models.anthropic import AnthropicModel from pydantic_ai.providers.anthropic import AnthropicProvider client = AsyncAnthropic(api_key=os.environ["SILK_API_KEY"], base_url="https://api.silkcompute.com") model = AnthropicModel("kimi-k3.1-pro-uncensored", provider=AnthropicProvider(anthropic_client=client))
Which model
In this setup
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.