{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "567-labs-instructor--switch-llm-providers-with-instructor-from-provider",
 "repo": "567-labs/instructor",
 "repo_url": "https://github.com/567-labs/instructor",
 "repo_slug": "567-labs-instructor",
 "title": "Run the same extraction on OpenAI, Anthropic or local Ollama",
 "page_title": "How to run the same extraction on OpenAI, Anthropic or local Ollama with Instructor",
 "summary": "Swap providers by changing one string in from_provider while the rest of the code stays the same.",
 "who": "A team comparing providers on cost and quality, or moving to a local model.",
 "problem": "Every provider has a different API shape for structured output.",
 "outcome": "One extraction function that runs on several providers.",
 "steps": [
  "Install with `uv add instructor` or `poetry 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"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "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.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip, uv or poetry",
  "An API key for your provider, or a local Ollama install",
  "Basic Pydantic knowledge"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "Passing api_key directly is supported, but keep keys in environment variables, not in code."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/567-labs-instructor/switch-llm-providers-with-instructor-from-provider/",
 "md": "https://dedupedai.com/use-cases/567-labs-instructor/switch-llm-providers-with-instructor-from-provider/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/567-labs-instructor--switch-llm-providers-with-instructor-from-provider.json",
 "api_version": "v1"
}
