DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to run the same extraction on OpenAI, Anthropic or local Ollama with Instructor

Swap providers by changing one string in from_provider while the rest of the code stays the same.

Short answer: Install with uv add instructor or poetry add instructor; then 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. All steps.

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

  1. Install with uv add instructor or poetry add instructor
  2. Create clients like Instructor.from_provider("ollama/llama3.2") or Instructor.from_provider("openai/gpt-4o")
  3. Call the same client.chat.completions.create with your response_model on each
  4. 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer