Credentials. Passing api_key directly is supported, but keep keys in environment variables, not in code.
Who it is forA team comparing providers on cost and quality, or moving to a local model.
The problemEvery provider has a different API shape for structured output.
The outcomeOne extraction function that runs on several providers.
What you need first
- Python with pip, uv or poetry
- An API key for your provider, or a local Ollama install
- Basic Pydantic knowledge
Steps
- Install with
uv add instructororpoetry add instructor - Create clients like Instructor.from_provider("ollama/llama3.2") or Instructor.from_provider("openai/gpt-4o")
- Call the same client.chat.completions.create with your response_model on each
- Compare accuracy and cost across providers
Prompt for your agent
With 567-labs/instructor, write a script that runs one extraction on instructor.from_provider("openai/gpt-4o") and instructor.from_provider("ollama/llama3.2") over <my 20 samples>, and reports where they disagree.
Caveat. This card is written from the 567-labs/instructor README, not from a test run by Deduped. Before you start, make sure you have Python with pip, uv or poetry. Check the repo for newer instructions before you rely on these steps.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for 567-labs/instructor and "Run the same extraction on OpenAI, Anthropic or local Ollama"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer