We raised $4M to scale our Agent-Led Growth Platform:Read more
Lightsage
Blog

7 Factors That Influence Which APIs Coding Agents Recommend

Jun Liang LeeJun Liang Lee10 min read
7 Factors That Influence Which APIs Coding Agents Recommend image

Why does Claude Code recommend Stripe when you ask for payments? Why does it suggest Vercel for deployments? And why does your API get skipped entirely?

After benchmarking 70+ APIs across Claude Code and Codex, we identified the 7 factors that determine which APIs coding agents recommend. Some are obvious. Others surprised us.

The 7 Factors (Ranked by Impact)

Based on our Devtool Arena benchmarks, here are the factors that influence coding agent API recommendations, ranked by measured impact:

RankFactorImpact ScoreCan You Control It?
1Training data presenceHighPartially
2Tool call success rateHighYes
3Web search visibilityHighYes
4llms.txt and machine-readable contextMedium-HighYes
5Error message qualityMediumYes
6MCP server availabilityMediumYes
7Documentation structureMediumYes

The good news: 6 of 7 factors are within your control. The bad news: most API teams optimize for none of them.


Factor 1: Training Data Presence

Impact: High | Control: Partial

Every coding agent is built on a large language model with a knowledge cutoff. If your API existed and was well-documented before that cutoff, the agent has baseline familiarity with your endpoints, auth patterns, and SDK.

What training data includes:

  • Documentation crawled before the cutoff
  • GitHub repositories using your API
  • Stack Overflow questions and answers
  • npm/PyPI package metadata
  • Blog posts and tutorials

Why it matters:

When a developer asks Claude Code for "a payment API," the agent's first instinct comes from training data. Stripe has massive training data presence. A payment API that launched last year has almost none.

What you can do:

  • You can't retroactively get into training data. But you can compensate with the other 6 factors.
  • Ensure your current docs are crawlable so they're included in future training runs.
  • Build GitHub presence through examples, integrations, and open-source tooling.

Benchmark insight:

In our tests, APIs with strong training data presence got recommended 3x more often for generic prompts ("add payments") than newer alternatives with objectively better features.


Factor 2: Tool Call Success Rate

Impact: High | Control: Yes

This is where many "well-known" APIs lose to smaller competitors. Tool call success rate measures: when an agent writes code using your API, does it actually work?

What affects success rate:

  • Typed responses: TypeScript definitions, JSON Schema, OpenAPI specs
  • Consistent response shapes: Same structure across endpoints
  • Clear authentication: Simple API key auth beats complex OAuth
  • Predictable errors: Structured error responses the agent can parse

Benchmark data:

In our tests, tool call success rates ranged from 94% to 47% across APIs:

FactorImpact on Success Rate
Typed responses (TypeScript/JSON Schema)+18%
Descriptive error messages+15%
Consistent import paths+12%
Clear quick start code+11%

What you can do:

  1. Add TypeScript definitions to your SDK
  2. Return consistent response envelopes across all endpoints
  3. Make errors specific: "Invalid API key format. Expected: sk_live_xxx" beats "Error 401"
  4. Test your quick start: Can a developer copy-paste it and get a working response?

Why this beats training data:

An API with 50% training data presence but 94% tool call success will outperform an API with 90% training data presence but 60% tool call success. Agents learn from failures and stop recommending tools that don't work.


Factor 3: Web Search Visibility

Impact: High | Control: Yes

According to Vercel's research, coding agents perform web searches in roughly 20% of prompts. When Claude Code searches, it's looking for:

  • Official documentation
  • "X vs Y" comparison pages
  • Recent tutorials and guides
  • GitHub READMEs

What blocks discovery:

# robots.txt blocking AI crawlers
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

Or JavaScript-only rendering that crawlers can't process.

What you can do:

  1. Allow AI crawlers in robots.txt (GPTBot, ClaudeBot, anthropic-ai)
  2. Server-side render your documentation
  3. Create comparison pages: "[Your API] vs [Competitor]"
  4. Publish task-oriented content: "How to add payments with [Your API]"

Benchmark insight:

APIs with dedicated comparison pages won those searches 78% of the time. APIs without comparison content let competitors define the narrative.


Factor 4: llms.txt and Machine-Readable Context

Impact: Medium-High | Control: Yes

The llms.txt standard provides AI systems with structured context about your API. It tells agents what your API does, when to use it, and critically, when NOT to use it.

What a good llms.txt includes:

# Acme Payments API

> Developer-first payment processing for startups.

## When to Use Acme
- Subscription billing with usage-based pricing
- Quick integration (15 minutes to first charge)
- Startups that don't need enterprise compliance yet

## When NOT to Use Acme
- Enterprise requiring SOC2/PCI Level 1
- In-person payments (use Square or Stripe Terminal)
- High-risk industries (use specialized processors)

## Quick Start
POST /v1/charges
Authorization: Bearer YOUR_API_KEY
Body: { "amount": 1000, "currency": "usd" }

Why "When NOT to Use" matters:

The "when not to use" section prevents over-recommendation. Agents that recommend your API for the wrong use case generate frustrated developers. The best APIs guide agents to recommend them only when appropriate.

Benchmark insight:

APIs with llms.txt files containing explicit positioning guidance received more accurate recommendations. They got recommended less often for inappropriate use cases and more often for appropriate ones.


Factor 5: Error Message Quality

Impact: Medium | Control: Yes

When agent-generated code fails, can the agent recover? Error message quality determines recovery rate:

Error StyleAgent Recovery Rate
"Invalid API key. Expected format: sk_live_xxx or sk_test_xxx"89%
"Authentication failed. Check your API key."67%
"Error 401"34%
"Internal server error"12%

What makes errors agent-friendly:

  1. Specific cause: What exactly went wrong
  2. Expected format: What the correct input looks like
  3. Actionable fix: What the developer should do
  4. Consistent structure: JSON error responses with code, message, and details

What you can do:

// Bad: Generic error
{ "error": "Bad request" }

// Good: Specific, actionable error
{
  "error": {
    "code": "invalid_api_key_format",
    "message": "API key must start with 'sk_live_' or 'sk_test_'",
    "received": "abc123",
    "expected_format": "sk_live_xxxxx or sk_test_xxxxx",
    "docs": "https://docs.acme.com/authentication"
  }
}

Factor 6: MCP Server Availability

Impact: Medium | Control: Yes

The Model Context Protocol (MCP) lets coding agents connect directly to your API. When your API has an MCP server, agents can:

  1. Discover that your API is available
  2. Call your endpoints directly
  3. Verify responses work before recommending

Benchmark insight:

APIs with MCP presence ranked significantly higher because agents can verify functionality before recommending. The recommendation changes from "I think this might work" to "I connected and verified it works."

MCP leaders by category:

CategoryMCP Leaders
Vector databasesChroma, Qdrant
SearchTavily, Exa
EmailAgentMail
AuthDescope, Clerk

What you can do:

  1. Build an MCP server following the MCP specification
  2. Publish to MCP registries
  3. Document MCP setup in your getting started guide
  4. Run a controlled MCP integration evaluation across the coding agents your customers use

Factor 7: Documentation Structure

Impact: Medium | Control: Yes

Documentation written for humans doesn't always work for agents. Agent-friendly documentation includes:

Structural elements that help:

  • Clear hierarchy: H1 for the page topic, H2 for sections, H3 for subsections
  • Code blocks with language tags: Agents parse these directly
  • Complete examples: Not snippets that require context from elsewhere
  • Explicit endpoint documentation: URL, method, headers, body, response

What hurts:

  • Tabbed code examples (agents can't always switch tabs)
  • Inline variables without explanation
  • Examples that depend on previous setup not shown on the page
  • PDFs or images containing code

Quick checklist:

  • Can someone copy your quick start and get a working response?
  • Are all endpoints documented with complete request/response examples?
  • Do code blocks have language tags (javascript, python)?
  • Is authentication explained before any endpoint documentation?

How to Track Product Visibility in Coding Agent Recommendations

Knowing the factors is step one. Measuring your position is step two.

What to track:

MetricWhat It Tells You
Recommendation rateHow often agents suggest your API for relevant prompts
Tool call success rateWhen agents write code with your API, does it work?
Share of voiceHow you compare to competitors for the same prompts
Error recovery rateWhen code fails, can agents fix it?

How to track:

Manual testing: Ask Claude Code and Codex to complete tasks that should use your API. Track whether they recommend you and whether the code works.

Lightsage: The Devtool Arena benchmarks APIs across all 7 factors. You can see your ranking, compare to competitors, and track changes over time. Lightsage tracks 23 AI platforms including 12 coding agents.


The Priority Matrix

Based on effort vs. impact:

PriorityFactorEffortImpact
1Fix robots.txt for AI crawlers5 minHigh
2Improve error messages1-2 daysHigh
3Add llms.txt30 minMedium-High
4Create comparison pages2-4 hoursHigh
5Add TypeScript definitions1-2 daysHigh
6Build MCP server1-2 weeksMedium

Start with factors 1-3. They take less than a day combined and address the most common visibility gaps.



FAQ

No. Unlike search ads, there's no way to buy placement in coding agent recommendations. The factors above are the only levers. This is why optimizing for them matters: your competitors can't buy their way past you.

How long until changes affect recommendations?

  • robots.txt fixes: 1-2 weeks as crawlers re-index
  • Error message improvements: Immediate for new users, gradual for training data
  • llms.txt: 2-4 weeks for discovery
  • MCP server: Immediate for users who install it

Do different coding agents have different factors?

The factors are the same, but weights differ. Claude Code relies more heavily on web search. Codex has stricter timeout handling. Test across multiple agents and track results separately.

What if my competitor has better training data?

Training data is the one factor you can't directly control. But the other 6 factors can overcome a training data disadvantage. In our benchmarks, newer APIs with optimized tool call success and error messages outranked established APIs coasting on training data alone.


Check Your API's Factor Score

Your API's visibility depends on all 7 factors working together. Most teams optimize for zero of them.

Free: Check the Devtool Arena leaderboard. See how your API ranks on each factor compared to competitors.

Full analysis: Get a Lightsage visibility report. Factor-by-factor breakdown with prioritized recommendations.

Community: Join the AI DevTool Demo Night. 3,500+ developer community, 50+ DevTool companies, hosted at AWS SF.

Is your API ready for the agent economy?

Developer tools and APIs use Lightsage to get discovered, recommended, and used by AI coding agents.