> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Search, scrape, crawl, map, extract, and answer with one API for web-aware AI applications.

# LLMLayer

LLMLayer is a web API for AI applications. Use one account and one API key to search the web, scrape pages, crawl websites, map URLs, extract structured data, process PDFs and YouTube transcripts, and generate web-grounded answers.

<CardGroup cols={2}>
  <Card title="Get API Key" icon="key" href="https://app.llmlayer.ai">
    Create an account and start with free credits.
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Inspect every endpoint and schema.
  </Card>
</CardGroup>

## Choose the Right API

| Job                                        | API                                       | Use it when                                                        |
| ------------------------------------------ | ----------------------------------------- | ------------------------------------------------------------------ |
| Answer a question with current web context | [Answer](/answer)                         | You want an LLM response with optional sources/images              |
| Get raw search results                     | [Web Search](/web-search)                 | You want to rank, filter, or scrape results yourself               |
| Scrape one page                            | [Scraper](/scrape)                        | You need markdown, HTML, or a screenshot from a URL                |
| Extract data from one page                 | [Extract](/extract)                       | You need schema-shaped data, a summary, Q\&A, links, or brand data |
| Crawl multiple pages                       | [Crawl](/crawl)                           | You need streamed markdown from a site                             |
| Discover URLs                              | [Map](/map)                               | You need a URL inventory before scraping or crawling               |
| Read a PDF                                 | [PDF Content](/scrape-pdf)                | You need text from a public PDF URL                                |
| Read a YouTube video                       | [YouTube Transcript](/youtube-transcript) | You need transcript text and video metadata                        |

## Install an SDK

<CodeGroup>
  ```bash Python theme={null}
  pip install llmlayer
  ```

  ```bash TypeScript theme={null}
  npm install llmlayer
  ```
</CodeGroup>

## First Request

<CodeGroup>
  ```python Python theme={null}
  from llmlayer import LLMLayerClient

  client = LLMLayerClient(api_key="YOUR_LLMLAYER_API_KEY")

  response = client.answer(
      query="What changed in AI regulation this week?",
      model="llmlayer-web",
      search_type="news",
      return_sources=True,
  )

  print(response.answer)
  print(response.sources)
  ```

  ```typescript TypeScript theme={null}
  import { LLMLayerClient } from 'llmlayer';

  const client = new LLMLayerClient({
    apiKey: process.env.LLMLAYER_API_KEY,
  });

  const response = await client.answer({
    query: 'What changed in AI regulation this week?',
    model: 'llmlayer-web',
    searchType: 'news',
    returnSources: true,
  });

  console.log(response.answer);
  console.log(response.sources);
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.llmlayer.dev/api/v2/answer \
    -H "Authorization: Bearer YOUR_LLMLAYER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "What changed in AI regulation this week?",
      "model": "llmlayer-web",
      "search_type": "news",
      "return_sources": true
    }'
  ```
</CodeGroup>

## Core Patterns

### Structured extraction

```python theme={null}
program = client.extract(
    "https://www.ycombinator.com/about",
    modes=["json"],
    json_schema={
        "program": "string",
        "duration": "string",
        "funding": "string",
        "benefits": ["string"],
    },
)

print(program.structured_data)
```

### Search then scrape

```typescript theme={null}
const search = await client.searchWeb({
  query: 'latest LLM evaluation research',
  domainFilter: ['arxiv.org', 'openai.com', '-reddit.com'],
});

const firstUrl = search.results[0]?.link;
if (typeof firstUrl === 'string') {
  const page = await client.scrape(firstUrl, {
    formats: ['markdown'],
    mainContentOnly: true,
  });
  console.log(page.markdown);
}
```

### Stream a crawl

```python theme={null}
for event in client.crawl_stream("https://www.ycombinator.com", max_pages=10):
    if event.get("type") == "page":
        print(event["page"].get("final_url"))
```

## Models

The currently documented model IDs are:

| Model                | Pricing style               | Best for                     |
| -------------------- | --------------------------- | ---------------------------- |
| `llmlayer-web`       | Flat per query              | Default web-grounded answers |
| `llmlayer-fast`      | Flat per query              | Lower latency answers        |
| `openai/gpt-4o-mini` | Token priced + LLMLayer fee | Budget token-priced answers  |
| `openai/gpt-5.1`     | Token priced + LLMLayer fee | Premium reasoning            |

<Note>
  `provider_key` is accepted for backward compatibility but currently ignored; provider usage is not billed to the user's provider account.
</Note>

## Pricing Snapshot

| API                | Cost                                                                  |
| ------------------ | --------------------------------------------------------------------- |
| Answer             | `$0.004 × max_queries` + model tokens, or flat LLMLayer model pricing |
| Web Search         | `$0.002` per request                                                  |
| Scraper            | `$0.001` per supported format                                         |
| Extract            | `$0.005` per AI mode, `$0.001` links, `$0.002` brand                  |
| Crawl              | `$0.001` per successful page, reported in the usage event             |
| Map                | `$0.002` per request                                                  |
| YouTube Transcript | `$0.003` per request                                                  |
| PDF Content        | `$0.002` per request                                                  |

Use response cost fields and the dashboard ledger as billing source of truth.

## Next Steps

<CardGroup cols={3}>
  <Card title="Answer API" icon="sparkles" href="/answer">
    Generate web-grounded answers.
  </Card>

  <Card title="Extract API" icon="wand-magic-sparkles" href="/extract">
    Turn pages into structured data.
  </Card>

  <Card title="Examples" icon="code" href="/examples/extract">
    Copy production-shaped recipes.
  </Card>
</CardGroup>
