# 7 Factors That Influence Which APIs Coding Agents Recommend

Why does Claude Code recommend Stripe over Square? The 7 factors that determine which APIs coding agents suggest, from 70+ benchmarks.

**Published:** 2026-08-30
**Updated:** 2026-08-30
**Category:** Guides
**Author:** Jun Liang Lee
**Read time:** 10 min read

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](https://lightsage.com/leaderboard) benchmarks, here are the factors that influence coding agent API recommendations, ranked by measured impact:

| Rank | Factor                                | Impact Score | Can You Control It? |
| ---- | ------------------------------------- | ------------ | ------------------- |
| 1    | Training data presence                | High         | Partially           |
| 2    | Tool call success rate                | High         | Yes                 |
| 3    | Web search visibility                 | High         | Yes                 |
| 4    | llms.txt and machine-readable context | Medium-High  | Yes                 |
| 5    | Error message quality                 | Medium       | Yes                 |
| 6    | MCP server availability               | Medium       | Yes                 |
| 7    | Documentation structure               | Medium       | Yes                 |

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:

| Factor                                   | Impact 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](https://vercel.com/blog/how-we-built-aeo-tracking-for-coding-agents), 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:

```txt
# 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:

```txt
# 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 Style                                                    | Agent 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:

```json
// 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:

| Category         | MCP Leaders    |
| ---------------- | -------------- |
| Vector databases | Chroma, Qdrant |
| Search           | Tavily, Exa    |
| Email            | AgentMail      |
| Auth             | Descope, Clerk |

### What you can do:

1. Build an MCP server following the [MCP specification](https://github.com/modelcontextprotocol/servers)
2. Publish to MCP registries
3. Document MCP setup in your getting started guide

---

## 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:

| Metric                 | What It Tells You                                      |
| ---------------------- | ------------------------------------------------------ |
| Recommendation rate    | How often agents suggest your API for relevant prompts |
| Tool call success rate | When agents write code with your API, does it work?    |
| Share of voice         | How you compare to competitors for the same prompts    |
| Error recovery rate    | When 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](https://lightsage.com/leaderboard) 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:

| Priority | Factor                         | Effort    | Impact      |
| -------- | ------------------------------ | --------- | ----------- |
| 1        | Fix robots.txt for AI crawlers | 5 min     | High        |
| 2        | Improve error messages         | 1-2 days  | High        |
| 3        | Add llms.txt                   | 30 min    | Medium-High |
| 4        | Create comparison pages        | 2-4 hours | High        |
| 5        | Add TypeScript definitions     | 1-2 days  | High        |
| 6        | Build MCP server               | 1-2 weeks | Medium      |

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

---

## Related Reading

- [How Coding Agents Actually Decide Which SDK to Use](/blog/how-coding-agents-decide-which-sdk-to-use): The 4-layer decision stack
- [How Coding Agents Actually Decide Which CLI to Use](/blog/how-coding-agents-decide-which-cli-to-use): CLI-specific factors
- [We Tested 70+ APIs in Claude Code and Codex](/blog/we-tested-50-apis-in-coding-agents): The benchmark data behind these findings
- [Why Claude Code Isn't Recommending Your Library](/blog/why-claude-code-not-recommending-your-library): Quick fixes for common issues

---

## FAQ

### Can I pay to get recommended by coding agents?

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](https://lightsage.com/leaderboard). See how your API ranks on each factor compared to competitors.

**Full analysis:** [Get a Lightsage visibility report](https://lightsage.com/welcome). Factor-by-factor breakdown with prioritized recommendations.

**Community:** Join the [AI DevTool Demo Night](https://luma.com/devtooldemo5). 3,500+ developer community, 50+ DevTool companies, hosted at AWS SF.
