dk-lm-studio-pydantic-ai
Use LM Studio as a local LLM backend with Pydantic AI for structured output extraction.
Skill by opencode
Chalk Labs
Need help deploying dk-lm-studio-pydantic-ai?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/dushyantkhosla-dk-lm-studio-pydantic-ai
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, ml, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Nov 1, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/dk-lm-studio-pydantic-ai
What's inside
- Skill name
dk-lm-studio-pydantic-ai- Description
- Use LM Studio as a local LLM backend with Pydantic AI for structured output extraction. Provides server setup, agent configuration, and extraction patterns using OpenAI-compatible API with local models. Use when user wants local inference, offline AI, or self-hosted LLMs.
- License
- MIT
- Compatibility
- Requires Python 3.10+, LM Studio, pydantic-ai. The `lmstudio` Python package is optional (CLI-based helpers used by default).
- Metadata
- author: opencode · version: 1.0.0 · opencode/autoinvoke: false
- Instructions
- 390 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (2)
- SKILL.md
- lmstudio_utils.py · references/
SKILL.md (first lines)
# LM Studio with Pydantic AI
Use LM Studio as a local inference backend with Pydantic AI to extract structured data from text using self-hosted LLMs.
## When to Use This Skill
Invoke this skill when:
- User wants to use a local LLM (LM Studio) with Pydantic AI
- User mentions LM Studio, local inference, offline AI, or self-hosted LLMs
- User asks to extract structured data from text (keywords, entities, sentiment)
- Building document processing pipelines
- Need structured output without API calls to OpenAI/Anthropic
Do **not** use this skill for:
- Cloud-based LLM providers (OpenAI, Anthropic, Google)
- General Pydantic AI agent patterns (use `building-pydantic-ai-agents` instead)
- Non-Pydantic AI frameworks
## Prerequisites
```bash
uv add "pydantic-ai-slim[openai]" python-dotenv
```
The `lmstudio` Python package is **optional** — by default, CLI-based helpers are used. If you prefer the Python SDK approach, add it with `uv add lmstudio`.
Ensure LM Studio is installed with a downloaded model.
## Quick-Start Patterns
### Ensure Model is Loaded
Always call this before creating any Pydantic AI agent. The helper functions are in `references/lmstudio_utils.py`:
```python
# lm_server.py (CLI-based, no extra package needed)
import sys
sys.path.insert(0, "path/to/references")
from lmstudio_utils import ensure_model_loaded
def ensure_model_loaded(model_name: str) -> str:
"""Ensure LM Studio server is running and model is loaded. Returns model identifier."""
from lmstudio_utils import ensure_server_running, load_model
ensure_server_running()
return load_model(model_name)
```
### Create a Structured Output Agent
```python
import os
from pydantic import BaseModel
from typing import List
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv())
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider
from pydantic_ai.settings import ModelSettings
from pydantic_ai.exceptions import UnexpectedModelBehavior
from lm_server import ensure_model_loaded
INFERENCE_MODEL = os.getenv("LOCAL_MODEL_INFERENCE") # Required - must be set in .env
LMSTUDIO_BASE_URL = os.getenv("LMSTUDIO_BASE_URL", "http://localhost:1234/v1")
# Define output schema (customize for your use case)
class PersonInfo(BaseModel):
name: str
email: str
skills: List[str]
# Create agent
def extract_person_info(text: str) -> PersonInfo:
ensure_model_loaded(INFERENCE_MODEL)
agent = Agent(
model=OpenAIChatModel(
INFERENCE_MODEL,
provider=OpenAIProvider(
base_url=LMSTUDIO_BASE_URL,
api_key="x",
),
),
model_settings=ModelSettings(
thinking=False,
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
),
retries=5,
output_type=PersonInfo,
instructions="Extract person information from the text. Return only valid JSON.",
)
try:
return agent.run_sync(user_prompt=text).output
except UnexpectedModelBehavior as exc:
raise RuntimeError(f"Extraction failed: {exc}")
```
### Agent Factory Pattern
For reusable agents:
```python
from typing import Type
from pydantic import BaseModel
def create_extractor(output_type: Type[BaseModel], instructions: str):
"""Factory for creating extraction agents."""
return Agent(
model=OpenAIChatModel(
INFERENCE_MODEL,From dushyantkhosla/agent-skills, MIT.
More from dushyantkhosla/agent-skills
- 0.570score
dk-wikibot
dushyantkhosla
Fetch, search, and extract information from Wikipedia, Wikidata, or any MediaWiki-based wiki using pywikibot.
SkillAFreshness: AClaude Code +9 - 0.570score
dk-wiki-article-writing
dushyantkhosla
Use when writing a Wikipedia-style article or comprehensive research-backed document on a technical topic.
SkillAFreshness: AClaude Code +9 - 0.566score
dk-transcribe-summarize
dushyantkhosla
Transcribe audio files or YouTube videos via subtitles or OpenRouter's multimodal API, generate 100-word and 400-word summaries using cloud models…
SkillAFreshness: AClaude Code +9 - 0.565score
here-now
dushyantkhosla
here.now lets agents publish websites and files to live URLs in seconds.
SkillAFreshness: AClaude Code +9 - 0.559score
browser-tools
dushyantkhosla
Browser automation over Chrome DevTools Protocol on port 9222 — navigate, evaluate JavaScript, take screenshots, and extract readable article content as…
SkillAFreshness: AClaude Code +9 - 0.553score
caveman
dushyantkhosla
Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy.
SkillAFreshness: AClaude Code +9 - 0.531score
improve-codebase-architecture
dushyantkhosla
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
SkillAFreshness: AClaude Code +9 - 0.531score
sdd-brainstorming
dushyantkhosla
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior.
SkillAFreshness: AClaude Code +9 - 0.523score
handoff
dushyantkhosla
Compact the current conversation into a handoff document for another agent to pick up.
SkillAFreshness: AClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 0
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Oct 7, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/dushyantkhosla/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from opencode
- 0.561score
odoo-implement
opencode
Implement Odoo features (Phase 1 vibe coding) - proposes, implements, deploys, and smoke-tests a feature; translations, coverage gates, and fresh rebuild are…
SkillAFreshness: AClaude Code +9 - 0.558score
odoo-harden
opencode
Harden the whole Odoo project before go-live - full automated audit and remediation of all modules
SkillAFreshness: AClaude Code +9 - 0.519score
web-design-guidelines
opencode
Review the UI code of self-hosted web apps for usability, accessibility, responsiveness, and implementation quality.
SkillBFreshness: BClaude Code +9 - 0.469score
odoo-finalize
opencode
Finalize Odoo change - archive with spec sync, create git commit, and push to remote
SkillCFreshness: CClaude Code +9 - 0.469score
odoo-explore
opencode
Enter Odoo explore mode - think through ideas with Odoo context awareness, patterns, and infrastructure knowledge
SkillCFreshness: CClaude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get dk-lm-studio-pydantic-ai running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
dk-lm-studio-pydantic-ai skill. Agent Mart. https://agentmart.dev/skills/dushyantkhosla-dk-lm-studio-pydantic-ai (last updated 2026-10-24)