Official agent skill

Adding A Provider API Feature

by pydantic in pydantic/pydantic-ai

Add a new provider API capability (prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, etc.) to Pydantic AI.

OfficialMITAuto-check passedAI & LLM Engineering

Install Adding A Provider API Feature

skills CLI
$ npx skills add pydantic/pydantic-ai --skill adding-a-provider-api-feature -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pydantic/pydantic-ai adding-a-provider-api-feature --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pydantic/pydantic-ai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/adding-a-provider-api-feature .claude/skills/adding-a-provider-api-feature && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
adding-a-provider-api-feature
GitHub stars
20k
Token cost
~3.2k tokens
SKILL.md length
1,313 words
Files
1
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Add a new provider API capability (prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, etc.) to Pydantic AI.

  • Works in 6 steps: Enumerate sibling precedent → Pick the API shape → Default: default-on (silent) vs opt-in → …
  • Wiring a provider feature through the library — it enforces reasoning from the existing cross-provider abstraction before designing anything
  • SKILL.md covers The one rule that prevents the…, Step 0 — Enumerate sibling…, Step 1 — Pick the API shape and Step 2 — Default: default-on…, plus 5 more sections
  • Calls gh

What it does

Adding A Provider API Feature is an agent skill from pydantic/pydantic-ai, published by the product's own GitHub organization. Add a new provider API capability (prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, etc.) to Pydantic AI. Use when wiring a provider feature through the library — it enforces reasoning from the existing cross-provider abstraction before designing anything, and picking default-on vs opt-in deliberately. Not for adding a new model id (that's a different flow) or a bug fix.

Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Structured output and tool calling, LLM cost and token optimization and Debugging. It works with Pydantic AI. The repository describes itself as: How Python does AI. Agents, realtime voice, image generation, embeddings. Every model, every interface, typed end to end. The licence is MIT.

When your agent uses it

  • Wiring a provider feature through the library — it enforces reasoning from the existing cross-provider abstraction before designing anything
  • Picking default-on vs opt-in deliberately

Example prompts

  • “/adding-a-provider-api-feature”

Requirements

  • Pre-approved tools (allowed-tools): Bash(git:*), Bash(gh:*), Bash(rg:*), Bash(ls:*), Bash(uv:*), Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Agent

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Enumerate sibling precedent
  2. Pick the API shape
  3. Default: default-on (silent) vs opt-in
  4. Capability gating
  5. Tests
  6. Docs & skills

What it can do on your machine

Read from SKILL.md and the folder at commit 402a2ed. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(git:*)
    • Bash(gh:*)
    • Bash(rg:*)
    • Bash(ls:*)
    • Bash(uv:*)
    • Read
    • Write
    • Edit
    • Glob
    • Grep

    …and 3 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Adding A Provider API Feature loads about 3.2k tokens when it runs. Until then it costs about 118 tokens; SKILL.md has 1,313 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~118
When it runs · the whole SKILL.md, loaded when a task matches
~3.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pydantic/pydantic-ai at commit 402a2ed, republished under its MIT licence (© pydantic). 1,313 words, ~3,210 tokens.

Download SKILL.mdSave it as .claude/skills/adding-a-provider-api-feature/SKILL.md (or your agent's skills folder).
name
adding-a-provider-api-feature
description
Add a new provider API capability (prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, etc.) to Pydantic AI. Use when wiring a provider feature through the library — it enforces reasoning from the existing cross-provider abstraction before designing anything, and picking default-on vs opt-in deliberately. Not for adding a new model id (that's a different flow) or a bug fix.
allowed-tools
Bash(git:*), Bash(gh:*), Bash(rg:*), Bash(ls:*), Bash(uv:*), Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Agent
user-invocable
true

Adding a provider API feature

Use this when exposing a new provider API capability through Pydantic AI — prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, cache breakpoints, and the like. The output is a change that is consistent with how sibling providers already expose the same concept, defaults deliberately, and gates support with a capability flag.

Not for: adding a new model id (that's add-new-model), a bug fix, or a refactor.

The one rule that prevents the most rework

Before designing anything, find the existing cross-provider abstraction that governs this capability and let its shape decide the API. Most "how should I expose this?" questions are already answered by an abstraction the codebase has — reaching for a new provider-specific knob when one exists is the single most common thing maintainers reject. When a feature routes through an existing abstraction, the abstraction's shape pre-decides the API surface, the opt-out, and often the default.

The tell that you skipped this: you find yourself listing 2-3 "options" for how a user controls the feature. If one of those options duplicates an existing cross-provider control, it isn't a real option — the existing abstraction wins.

Step 0 — Enumerate sibling precedent

For the capability you're adding, list how every provider that already has an analog exposes it, and name the governing existing abstraction. It is one of:

  • a per-tool flag — ToolDefinition.strict: bool | None (tools.py), resolved in models/__init__.py::_customize_tool_def;
  • a shared ModelSettings field — thinking, service_tier (settings.py), each with per-model resolvers mapping to native concepts;
  • a provider-prefixed {Provider}ModelSettings field — anthropic_cache, openai_prompt_cache_key, groq_reasoning_effort;
  • a message-stream marker — CachePoint in UserPromptPart.content (messages.py);
  • a ModelProfile capability flag — openai_supports_strict_tool_definition, bedrock_supports_prompt_caching.

Read the actual sibling implementations and any review threads on the PRs that added them (gh pr view <n> --comments). Contributors who skipped this got redirected: raw google_tool_config → use strict (#5366); string-prefix model detection → use a profile flag (#4604). Only open a design fork if no existing abstraction covers the capability.

Step 1 — Pick the API shape

  1. An existing cross-provider abstraction covers it → reuse it. Add a provider mapping (a _translate_* resolver, a JsonSchemaTransformer subclass, a CachePoint translation). Do not add a provider-prefixed knob for something the shared abstraction already expresses.
  2. No shared abstraction, but ≥3 providers now have the concept → promote to a shared ModelSettings field with a deliberately narrow common vocabulary and per-model resolvers, keeping per-provider fields underneath as precedence-winning escape hatches (the service_tier promotion, #4926). Don't delete provider knobs; deprecate only genuinely-misnamed ones with a TODO(v3).
  3. The provider's native values can't be expressed by the shared enum (family-disjoint value sets, platform-only request shaping) → a {provider}_* knob is justified, and it coexists with and outranks the unified field (groq_reasoning_effort, #5797).
  4. Choose the locus by "can the user naturally point at it?": a boundary inside the message stream → a marker (CachePoint); a structural region (system prompt, tool defs, whole-request setting) → a setting (#3363).
  5. Wire it into every request path the provider has (chat and responses APIs); put a setting shared across a provider's APIs on the base settings class (#3678).
  6. Type it. Reuse the provider SDK's own types where they exist; type knobs as Literal, never extra_body or untyped **kwargs (models/AGENTS.md; "kwargs are a big no no… I'd rather be repetitive but type safe" — DouweM, #3457).

Step 2 — Default: default-on (silent) vs opt-in

Default the feature on only when enabling it cannot change observable behavior and cannot cost the user — a pure, backward-compatible improvement (caching only lowers cost; a validation mode that needs no schema rewrite and can't reject a previously-valid request). A backward-compatible, purely-better default is welcome and needs no opt-in.

Keep it opt-in when it:

  • changes observable output or wire behavior;
  • is a preview feature (provider may change semantics);
  • can raise cost — and choose the default value so a shared field never silently upgrades anyone to a pricier tier (service_tier 'auto' vs 'default', #4926);
  • can hit provider limits at scale (auto-promoting strict silently broke agents with >20 tools; reverted in #5580);
  • applies lossy schema rewrites (OpenAI/Anthropic strict transforms).

When the default isn't obvious, decide it with a live probe, not an opinion (#5897 flipped a default on 0/5 → 5/5 recovery). Beware "automatic" language — verify whether it means a Pydantic AI default or just provider-side management of an opt-in feature.

Step 3 — Capability gating

Detect support with a provider-prefixed ModelProfile flag set in Provider.model_profile() — never inline isinstance/model-name checks (profiles/AGENTS.md). Gate at the layer(s) that actually vary:

  • model/family → profile flag (google_supports_strict_tool_definition, bedrock_supports_prompt_caching);
  • per-schema → the JsonSchemaTransformer.is_strict_compatible signal (default conservative unless the mode needs no rewrites);
  • SDK version → probe the SDK shape and degrade with a UserWarning (#5580, botocore strict param);
  • unknowable client-side → defer to the runtime API error.

Unsupported → silently ignore the setting (best-effort so as many requests as possible succeed), documented in the docstring — never hard-error. Conflicting user settings → UserWarning, not UserError. Profiles are layered: developer-keyed base + thin provider overlay resolved per family, with the provider overlay layering last (#5934, #6231).

Show full SKILL.md (495 more words)Show less

Step 4 — Tests

Live-recorded wire-contract cassette asserting the exact outbound body (mode/field is sent for supported models, absent/ignored for unsupported), plus a test exercising the new setting. Prefer case-based parametrized VCR over mocks; a unit test is still right for asserting an internal request shape a cassette matcher wouldn't catch. This is also where a review bot's "this will fail" claim gets refuted with a recorded cassette.

Step 5 — Docs & skills

The new public symbol's docstring lists which providers support it and how each interprets the value. Add/refresh the docs/**.md section and any sibling docstrings that now under-claim ("only OpenAI" → the full provider list). Describe the mechanism only as far as the provider documents it — don't assert a mechanism a provider's docs leave unstated. Update the relevant agent skill.

ModelSettings' Supported by: lists are enforced: tests/models/test_model_settings_support.py probes each model class's outgoing request and asserts every list names exactly the classes that send the field. Forwarding a new setting means editing its list, and a new Model class means adding a Case there. tool_choice and thinking are exempt via HAND_MAINTAINED and stay hand-maintained.

Recurring maintainer principles (quoted)

  1. Reuse the cross-provider abstraction over a provider knob — "this maps to what the Anthropic and OpenAI APIs call strict… already represented on ToolDefinition… a more complete, consistent, 'doesn't require the user to do something special' implementation would be to automatically use this mode." (#5366)
  2. Promote to a shared setting once several providers have the concept; keep per-provider overrides underneath. (#4926)
  3. Best-effort — silently ignore unsupported settings, don't error. "we typically do a 'best effort' so that as many requests as possible succeed." (#3438)
  4. Hide provider complexity — the feature should be useful to people who don't want to become experts in that provider's limitations.
  5. Capability facts belong on ModelProfile flags, layered base + overlay. (#5934)
  6. Type safety over repetition; no untyped kwargs. (#3457)
  7. Put shared fields on the base settings class; cover every API surface. (#3678)
  8. Verify against the real API; defer validation to runtime. "If they're allowed by the SDK types and we can try it out and it doesn't fail, I'm fine with it." (#3678)
  9. Name the eventual unification even when deferring it — a {provider}_* knob today can note the future Caching/Thinking-style capability it should fold into. (#4604)

Precedent map

CapabilityReused abstractionDefaultGatingPR
service tier (cross-provider)promoted to ModelSettings.service_tieropt-in, never silent upgrademap-and-drop#4926
strict — OpenAI (origin)ToolDefinition.strictauto-promote per compatible schemaper-schema is_strict_compatible#1304
strict — Anthropicreused strictconservative opt-intransformer + profile flag#3457
strict — Bedrock (+ fix)reused strictopt-in (auto-promote reverted)transformer + profile + SDK probe#4237, #5580
strict — Gemini VALIDATEDreused strict; rejected raw google_tool_configdefault-on (mode needs no schema rewrite)profile flag; is_strict_compatible = True#6353
thinking (cross-provider)ModelSettings.thinking + per-provider mapsopt-in, graceful degradationsupports_thinking flags#4640
reasoning effort — Groqprovider knob coexists with thinking, outranks itopt-inper-family profile flag#5797, #6231
prompt caching — Anthropic → Bedrock/OpenRouterCachePoint marker + settingsopt-in{provider}_supports_prompt_caching#3363, #3438, #4604

© pydantic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/adding-a-provider-api-feature of pydantic/pydantic-ai.

Open the folder on GitHubat commit 402a2ed

Compare with similar skills

Adding A Provider API Feature next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Adding A Provider API Feature compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Adding A Provider API Feature this skillpydantic/pydantic-ai20k—~3.2kAutomated safety check: PassMIT
Pydantic AIdavila7/claude-code-templates32k4 repos~2.9kAutomated safety check: PassMIT
Building Pydantic AI Agentsdocling-project/docling68k—~2.8kAutomated safety check: PassMIT
Celeste Pythonwithceleste/celeste-python221—~1.1kAutomated safety check: PassMIT
Prompt EngineerJeffallan/claude-skills12k1 repos~1.5kAutomated safety check: PassMIT
Langfuse and LLM Gateway LogsKonghaYao/peri223—~4.3kAutomated safety check: NotesApache-2.0

Similar skills

  • Pydantic AI

    davila7/claude-code-templates

    Build production-ready AI agents with PydanticAI — type-safe tool use, structured outputs, dependency injection, and multi-model support.

    32k GitHub starsUsed in 4 repos~2.9k tokens
    AI & LLM EngineeringAuto-check passed
  • Building Pydantic AI Agents

    docling-project/docling

    Patterns and tested examples for building agents with Pydantic AI: tools, capabilities, structured output, dependency injection, hooks, YAML specs, streaming and testing.

    68k GitHub stars~2.8k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Celeste Python

    withceleste/celeste-python

    A skill your agent uses whenever writing, modifying, reviewing, or debugging code involving Celeste, celeste-ai, celeste-python, import celeste, src/celeste, or withceleste app integrations.

    221 GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Prompt Engineer

    Jeffallan/claude-skills

    Designs, tests and refines LLM prompts: zero-shot, few-shot and chain-of-thought patterns, system prompts, structured output schemas and evaluation test suites.

    12k GitHub starsUsed in 1 repo~1.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Queries Langfuse traces, prompts, datasets and sessions, and analyzes local LLM gateway logs for requests, context growth, token use and cache hits.

    223 GitHub stars~4.3k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes
  • Official

    Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns.

    140 GitHub stars~5.4k tokensUpdated 6 days ago
    AI & LLM EngineeringAuto-check passed

More from pydantic/pydantic-ai

All 20 skills in this repo
  • Pydantic AI Harness

    pydantic/pydantic-ai

    Official

    Adds optional capabilities to Pydantic AI agents from pydantic-ai-harness, led by Code Mode, which runs many tool calls as one sandboxed Python script.

    20k GitHub stars~4.9k tokensUpdated today
    Auto-check passed
  • Building Pydantic AI Agents

    pydantic/pydantic-ai

    Official

    Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming, testing, and multi-agent patterns.

    20k GitHub stars~8k tokensUpdated today
    Auto-check passed
  • Complete Partial PR

    pydantic/pydantic-ai

    Official

    Evaluate and complete an issue or PR where the submitted patch fixes only a narrow symptom of the reported pain point.

    20k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Testing Skill

    pydantic/pydantic-ai

    Official

    Record, rewrite, and debug VCR cassettes for HTTP recordings.

    20k GitHub stars~839 tokensUpdated today
    Auto-check: notes
  • Migrating Agno To Pydantic AI

    pydantic/pydantic-ai

    Official

    Migrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness.

    20k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Official

    Migrate Python applications from the Claude Agent SDK to Pydantic AI and, only when needed, Pydantic AI Harness.

    20k GitHub stars~1.6k tokensUpdated today
    Auto-check passed

Works with

Questions about Adding A Provider API Feature

What does Adding A Provider API Feature do?

Add a new provider API capability (prompt caching, strict/structured tool calling, thinking/reasoning effort, service tier, safety settings, logprobs, etc.) to Pydantic AI. Adding A Provider API Feature is an agent skill from pydantic/pydantic-ai, published by the product's own GitHub organization.) to Pydantic AI.

When should I use Adding A Provider API Feature?

Adding A Provider API Feature fits situations like: wiring a provider feature through the library — it enforces reasoning from the existing cross-provider abstraction before designing anything; picking default-on vs opt-in deliberately.

How do I install Adding A Provider API Feature in Claude Code?

Run `npx skills add pydantic/pydantic-ai --skill adding-a-provider-api-feature -a claude-code`. Or copy the skill folder (.agents/skills/adding-a-provider-api-feature in pydantic/pydantic-ai) into .claude/skills/adding-a-provider-api-feature in your project. Claude Code loads it when a task matches its description.

How do I install Adding A Provider API Feature in Codex?

Run `npx skills add pydantic/pydantic-ai --skill adding-a-provider-api-feature -a codex`. Or copy the skill folder (.agents/skills/adding-a-provider-api-feature in pydantic/pydantic-ai) into .agents/skills/adding-a-provider-api-feature in your project. Codex loads it when a task matches its description.

Can I use Adding A Provider API Feature in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pydantic/pydantic-ai --skill adding-a-provider-api-feature -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/adding-a-provider-api-feature, .gemini/skills/adding-a-provider-api-feature, .github/skills/adding-a-provider-api-feature and .opencode/skills/adding-a-provider-api-feature in your project.

What does Adding A Provider API Feature need to run?

Going by SKILL.md and its folder, Adding A Provider API Feature needs the command-line tools its instructions call (gh). Its frontmatter pre-approves these tools: Bash(git:*), Bash(gh:*), Bash(rg:*), Bash(ls:*), Bash(uv:*), Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Agent.

Does Adding A Provider API Feature access the network?

SKILL.md contains no URLs. Its commands use gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Adding A Provider API Feature safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Adding A Provider API Feature use?

Adding A Provider API Feature is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Adding A Provider API Feature use?

About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Adding A Provider API Feature?

Skills that share tags, products or a category with Adding A Provider API Feature: Pydantic AI (davila7/claude-code-templates, 32k stars), Building Pydantic AI Agents (docling-project/docling, 68k stars), Celeste Python (withceleste/celeste-python, 221 stars) and Prompt Engineer (Jeffallan/claude-skills, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Adding A Provider API Feature?

pydantic (a GitHub organization, an official publisher) maintains it in pydantic/pydantic-ai, which has 20,465 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 7, 2026.

Source: pydantic/pydantic-ai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.