Skip to main content

Nexract — Web Intelligence API SDK. Extract, analyze, and monitor any webpage. Built-in OpenAI, Claude, and LangChain integrations.

Project description

Nexract — Web Intelligence API SDK

Extract, analyze, and monitor any webpage with one API call.

PyPI version

Features

  • Extract clean markdown from any public URL
  • AI Analysis — summary, sentiment, entities, categories (powered by Claude)
  • Batch Extract — up to 10 URLs in one request
  • Schema Extraction — custom JSON schema for structured data
  • OpenAI Tool — built-in function calling definition
  • Claude Tool — built-in Anthropic tool definition
  • LangChain Tool — native StructuredTool integration
  • Content Filtering — max_words, no_links, first_paragraphs
  • Retry Logic — automatic exponential backoff for 429/503
  • Arabic Intelligence — dialect detection, bilingual analysis

Install

pip install nexract

For LangChain integration:

pip install nexract[langchain]

Quick Start

from nexract import Nexract

nx = Nexract("SK-LAB-YOUR-KEY")

# Basic extraction (1 credit)
result = nx.extract("https://example.com/article")
print(result.data)        # Clean markdown
print(result.title)       # Article title
print(result.word_count)  # Word count

# With AI analysis (+2 credits)
result = nx.extract("https://bbc.com/article", ai=True)
print(result.summary)     # AI-generated summary
print(result.sentiment)   # positive/negative/neutral

# Batch extract (up to 10 URLs)
batch = nx.batch_extract([
    "https://site1.com",
    "https://site2.com",
    "https://site3.com",
])
for r in batch:
    print(r.title, r.word_count)

# Check balance
bal = nx.balance()
print(f"Credits: {bal.balance}")

OpenAI Integration

from openai import OpenAI
from nexract import Nexract
import json

nx = Nexract("SK-LAB-YOUR-KEY")
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Summarize https://example.com"}],
    tools=[nx.openai_tool()],  # One line!
)

for call in response.choices[0].message.tool_calls or []:
    if call.function.name == "nexract_extract":
        args = json.loads(call.function.arguments)
        content = nx.handle_tool_call(args)
        print(content)

Claude Integration

import anthropic
from nexract import Nexract

nx = Nexract("SK-LAB-YOUR-KEY")
client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    tools=[nx.claude_tool()],  # One line!
    messages=[{"role": "user", "content": "Extract https://example.com"}],
)

for block in response.content:
    if block.type == "tool_use" and block.name == "nexract_extract":
        content = nx.handle_tool_call(block.input)
        print(content)

LangChain Integration

from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from nexract import Nexract

nx = Nexract("SK-LAB-YOUR-KEY")
llm = ChatOpenAI(model="gpt-4o")

agent = initialize_agent(
    tools=[nx.langchain_tool()],  # One line!
    llm=llm,
    agent=AgentType.OPENAI_FUNCTIONS,
)

result = agent.invoke("Summarize https://techcrunch.com")
print(result["output"])

API Reference

Method Description
nx.extract(url, **options) Extract a webpage (1 credit)
nx.batch_extract(urls, **options) Extract multiple URLs (1 credit each)
nx.balance() Check credit balance
nx.openai_tool() OpenAI function calling definition
nx.claude_tool() Anthropic Claude tool definition
nx.langchain_tool() LangChain StructuredTool
nx.handle_tool_call(args) Handle AI tool call → returns content string

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexract-2.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexract-2.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file nexract-2.0.0.tar.gz.

File metadata

  • Download URL: nexract-2.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nexract-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c946849d5f516ddb322bd472fe9a7aff5f0c7f7a8d1e82d667d6e1fd157e5f88
MD5 4c40b4924f5132ecb289fc114b7b9971
BLAKE2b-256 abf8e8e4909f3d3d74f3af3a2d9f1ee850d1fea42aba2759a4680bf67ac73fc5

See more details on using hashes here.

File details

Details for the file nexract-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: nexract-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nexract-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46ebd1d5f702df6bd66952ec8a2944e08c27cdd630e9a08303a28382fb847424
MD5 45a3065ed682744dda29abd0865386c5
BLAKE2b-256 24eddf05eb1ff0fe21b7b469d980836596642a533770efcb23c8749807ac380c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page