# Nexract

Web extraction API for AI agents and LLMs.

Give your AI agent the ability to read any webpage — one API call, clean markdown output.

```bash
pip install nexract
```

## Quick Start

```python
from nexract import Nexract

client = Nexract(api_key="SK-LAB-YOUR-KEY")
result = client.extract("https://example.com/article")

print(result.title)
print(result.markdown)
```

## OpenAI Function Calling

```python
import openai
import json
from nexract import Nexract

client = Nexract(api_key="SK-LAB-YOUR-KEY")
openai_client = openai.OpenAI()

messages = [{"role": "user", "content": "Summarize https://news.ycombinator.com"}]

response = openai_client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=[Nexract.openai_tool()],
)

# Handle tool call
tool_call = response.choices[0].message.tool_calls[0]
args      = json.loads(tool_call.function.arguments)
content   = client.handle_tool_call(args["url"])

print(content)
```

## Batch Extraction

```python
urls = [
    "https://example.com/page1",
    "https://example.com/page2",
    "https://example.com/page3",
]

results = client.extract_batch(urls)

for result in results:
    print(f"{result.title} — {result.word_count} words")
```

## Check Balance

```python
info = client.balance()
print(f"Credits remaining: {info['balance']}")
```

## Get Your API Key

→ [nexract.ai/pricing.html](https://www.nexract.ai/pricing.html)

## Links

- [Documentation](https://www.nexract.ai/integrations.html)
- [Website](https://www.nexract.ai)
- [Support](mailto:support@nexract.ai)
