# Scrape a page into JSON

> Put a public URL in a chat prompt and get a JSON object back. Both Interfaze chat models take the same call.


# Scrape a page into JSON

The call is a chat completion. Put a public URL in the user message, send a JSON schema, and read the object on `choices[0].message.content`.

## Models

Two listed models take this call. Both are Interfaze chat models. The vendor documents the fetch on [Web scraping](https://interfaze.ai/docs/web/web-scraping). Their SDK also returns the raw page extract on `precontext`, from a tool named `web_extract`. AnyRouter returns an OpenAI chat completion and does not include `precontext`.

| Model | Context | List price per 1M, in / out | Inputs |
| --- | --- | --- | --- |
| [`interfaze/interfaze-1`](https://anyrouter.dev/model/interfaze/interfaze-1) | 1,000,000 | $1.50 / $3.50 | Text, image, audio, file, video |
| [`interfaze/interfaze-1.1-lite`](https://anyrouter.dev/model/interfaze/interfaze-1.1-lite) | 131,072 | $0.85 / $1.50 | Text, image, audio, file |

List prices are Interfaze's published rates on 2026-11-22. Lite is the open-weight model. The samples below use `interfaze/interfaze-1`. Use `interfaze/interfaze-1.1-lite` in the same body when you want the smaller model.

No other listed model fetches a URL from the prompt into that JSON field. These models can search the web, which is a different request. `openai/gpt-4o` and `openai/gpt-4o-mini` list `web_search_options`. So do `perplexity/sonar-pro-search`, `perplexity/sonar-reasoning-pro`, `perplexity/sonar-deep-research`, and `sakana/fugu-max`. `sakana/fugu`, `sakana/fugu-ultra`, and `sakana/sakana-namazu` are marked `web-search`. `qwen/qwen4-max` documents `web_extractor` and `web_fetch` on QwenCloud's Responses and Anthropic tools, not on this chat body.

## Before the call

1. Create an Interfaze API key in the [Interfaze dashboard](https://interfaze.ai/dashboard).
2. Add that key under [Dashboard, BYOK, Interfaze](https://anyrouter.dev/dashboard/byok). Interfaze bills that key. AnyRouter does not charge credits for the hop.
3. Create an AnyRouter key (`sk-ar-v1-...`) under [Dashboard, Keys](https://anyrouter.dev/dashboard/keys). The examples below use that key.

List price on 2026-11-22 is $1.50 per million input tokens and $3.50 per million output tokens for Interfaze 1. Interfaze 1.1 Lite is $0.85 and $1.50. Interfaze's published profile example reports 22,451 prompt tokens and 49,971 completion tokens. Check [pricing](https://interfaze.ai/pricing) before a large run. Use a URL you are allowed to fetch.

## Extract fields from a public page

The schema asks for the title and a one-sentence summary of Interfaze's own scraping page.

::::tabs

:::tab{label="Python"}

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://anyrouter.dev/api/v1",
    api_key=os.environ["ANYROUTER_API_KEY"],
)

completion = client.chat.completions.create(
    model="interfaze/interfaze-1",
    messages=[
        {
            "role": "user",
            "content": "Extract the title and a one-sentence summary from https://interfaze.ai/docs/web/web-scraping",
        }
    ],
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "page",
            "schema": {
                "type": "object",
                "properties": {
                    "title": {"type": "string"},
                    "summary": {"type": "string"},
                },
                "required": ["title", "summary"],
                "additionalProperties": False,
            },
        },
    },
)
print(completion.choices[0].message.content)
```

:::

:::tab{label="TypeScript"}

```typescript
import OpenAI from "openai"

const client = new OpenAI({
  baseURL: "https://anyrouter.dev/api/v1",
  apiKey: process.env.ANYROUTER_API_KEY,
})

const completion = await client.chat.completions.create({
  model: "interfaze/interfaze-1",
  messages: [
    {
      role: "user",
      content:
        "Extract the title and a one-sentence summary from https://interfaze.ai/docs/web/web-scraping",
    },
  ],
  response_format: {
    type: "json_schema",
    json_schema: {
      name: "page",
      schema: {
        type: "object",
        properties: {
          title: { type: "string" },
          summary: { type: "string" },
        },
        required: ["title", "summary"],
        additionalProperties: false,
      },
    },
  },
})
console.log(completion.choices[0]?.message.content)
```

:::

:::tab{label="AI SDK"}

```typescript
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText, Output } from "ai"
import { z } from "zod"

const anyrouter = createAnyRouter()

const { output } = await generateText({
  model: anyrouter("interfaze/interfaze-1"),
  output: Output.object({
    schema: z.object({
      title: z.string(),
      summary: z.string(),
    }),
  }),
  prompt:
    "Extract the title and a one-sentence summary from https://interfaze.ai/docs/web/web-scraping",
})
console.log(output)
```

:::

::::

## MCP scrape tool

These connectors scrape or fetch pages. They are not chat model ids, and they do not use the call above.

| Connector | Server | What it does |
| --- | --- | --- |
| [Interfaze](https://anyrouter.dev/mcp) | `https://api.interfaze.ai/mcp` | `scraper`, plus search, OCR, transcription, translation, and forecast. Needs an Interfaze API key. |
| [Firecrawl](https://anyrouter.dev/mcp) | `https://mcp.firecrawl.dev/v2/mcp` | Scrape, crawl, and search. Needs a Firecrawl API key. |
| [Exa](https://anyrouter.dev/mcp) | `https://mcp.exa.ai/mcp` | Search and fetch page content. Connects without a key. |

Each one calls that vendor directly. None of them goes through `interfaze/interfaze-1` or `interfaze/interfaze-1.1-lite`.


## Related

- [OpenAI SDK](/docs/guides/openai-sdk.md)
- [Vercel AI SDK](/docs/guides/vercel-ai-sdk.md)
- [Bring Your Own Key (BYOK)](/docs/features/byok.md)
- [AnyRouter MCP Overview](/docs/mcp.md)
