AlterLabAlterLab
PricingComparePlaygroundBlogDocsChangelog
    AlterLabAlterLab
    PricingComparePlaygroundBlogDocsChangelog
    IntroductionQuickstartInstallationYour First Request
    REST APICrawl APIMap APISearch APISERP APINewExtract APIAIJob PollingAPI KeysSessions APINewEnterprise APIEnterprise
    AccountAutoAlertsAutoAuthAutoBillingAutoCrawlAutoExtractAutoIntegrationsAutoKeysAutoMapAutoMonitorsAutoOrganizationsAutoSchedulesAutoScrapeAutoSearchAutoSessionsAutoUser WebhooksAutoV1 EndpointsAutoWebhooksAuto
    OverviewPythonNode.js
    JavaScript RenderingOutput FormatsPDF & OCRCachingWebhooksJSON Schema FilteringWebSocket Real-TimeBring Your Own ProxyProAuthenticated ScrapingNewHTTP Methods & BodiesNewStructured ExtractionAIWeb SearchSite MappingWeb CrawlingBatch ScrapingSchedulerChange DetectionCloud Storage ExportSpend LimitsOrganizations & TeamsAlerts & NotificationsExtraction ProfilesAIBYOK ExtractionAIOAuth2 Machine-to-MachineSupport & TicketsUnsupported Targets
    Structured ExtractionAIE-commerce ScrapingNews MonitoringPrice MonitoringMulti-Page CrawlingMonitoring DashboardAI Agent / MCPMCPAI Research AgentAISite CrawlingData Pipeline to Cloud
    E-commerceLead GenerationChange MonitoringRAG & AI PipelinesAIResearch
    PricingRate LimitsError CodesChangelogVersioning
    From FirecrawlFrom ApifyFrom ScrapingBee / ScraperAPIFrom Crawl4AIFrom SpiderFirecrawl v0 API ReferenceLegacy
    OverviewMCP ServerAIn8n NodeLangChainAICrewAIAILlamaIndexAISupabaseChrome ExtensionSoon
    PlaygroundPricingStatus

    5,000 free requests · No credit card

    Guide
    AI

    BYOK Extraction

    Use your own LLM API key for extraction. AlterLab orchestrates the pipeline and charges a flat invocation fee — your token costs stay between you and your provider.

    Zero markup on tokens

    AlterLab does not provision LLM access or mark up token costs. You bring your own key, we run the extraction pipeline, and you pay your provider directly for tokens. AlterLab charges only a flat $0.003 invocation fee per LLM extraction call.

    How It Works

    1

    Register your provider key

    Add your OpenAI, Anthropic, OpenRouter, or Groq API key to your AlterLab account. Keys are stored encrypted and never logged.

    2

    Send extraction request

    POST content + an extraction_prompt to /api/v1/extract. AlterLab cleans the content, builds the LLM prompt, and calls your registered provider.

    3

    Receive structured output

    Get clean, typed JSON back — with token usage, model name, and latency surfaced in the response for cost tracking.

    4

    Pay your provider separately

    Token costs are billed directly by your LLM provider. AlterLab deducts only its flat invocation fee from your balance.

    Supported Providers

    ProviderKey FormatBest ForNotes
    OpenAIsk-...GPT-4o, GPT-4o-mini — general extractionHigh accuracy, moderate cost. JSON mode enforced.
    Anthropicsk-ant-...Claude Haiku, Sonnet — complex reasoningExcellent instruction following. Best for nuanced prompts.
    OpenRoutersk-or-...Access 100+ models via one keyRoute to cheapest available model. Good for cost optimization.
    Groqgsk_...Llama 3, Mixtral — ultra-fast inferenceFastest latency. Best for high-throughput pipelines.

    Model selection

    AlterLab selects the most cost-efficient model available on your registered provider. You can override the model by specifying it in your account settings. The model used is always returned in the response as model_used.

    Cost Model

    BYOK extraction has two cost components: an AlterLab invocation fee and the token cost billed by your provider.

    Cost ComponentAmountBilled ByNotes
    AlterLab base extraction$0.0025 / callAlterLab balanceApplies to all /v1/extract calls, including algorithmic
    LLM invocation fee+$0.001 / callAlterLab balanceOnly when extraction_prompt is provided
    Token costProvider ratesYour providerBilled by OpenAI / Anthropic / OpenRouter / Groq directly
    Large content surcharge+$0.0025 / callAlterLab balanceContent > 200K characters

    Example cost breakdown

    Extracting product data from a 50K-character HTML page using GPT-4o-mini:

    AlterLab base (algorithmic pipeline)$0.0025
    AlterLab LLM invocation fee$0.0010
    OpenAI tokens (~2K in / 200 out at GPT-4o-mini rates)~$0.0003
    Total per extraction~$0.0038

    Token usage in response

    Every LLM extraction response includes model_used and extraction metadata so you can track costs accurately across providers.

    When to Use LLM Extraction

    AlterLab runs algorithmic extraction by default — it is faster, cheaper, and deterministic. LLM extraction is invoked only when you provide an extraction_prompt.

    ScenarioRecommendedReason
    HTML with Schema.org / Open Graph metadataSchema or profile (no prompt)Algorithmic — faster, $0.0025 total, deterministic
    E-commerce product pagesProfile: product (no prompt)Profile templates handle standard product data structures
    Plain text, OCR output, transcriptsLLM with prompt + schemaNo HTML structure to parse — LLM understands natural language
    Summarization, sentiment, classificationLLM with promptRequires reasoning — algorithmic extraction cannot infer semantics
    Complex multi-field extraction with contextLLM with prompt + schemaSchema ensures typed output; prompt provides reasoning context

    Register Your API Key

    Register your LLM provider key via the dashboard or API. Keys are encrypted at rest and are never returned in API responses or logs.

    Via Dashboard

    1. Go to Dashboard → Settings → LLM Keys
    2. Click Add Provider Key
    3. Select your provider (OpenAI, Anthropic, OpenRouter, Groq)
    4. Paste your API key and give it a label
    5. Click Save — the key is tested and encrypted immediately

    Key permissions

    Use a key with only the permissions needed for inference. For OpenAI, a key scoped to model.request is sufficient. Never use organization admin keys.

    Your First Extraction

    Once your key is registered, add an extraction_prompt to any extraction request. The LLM is invoked automatically when a prompt is present.

    Python
    import requests
    
    response = requests.post(
        "https://api.alterlab.io/api/v1/extract",
        headers={"X-API-Key": "YOUR_ALTERLAB_KEY"},
        json={
            "content": article_html,
            "content_type": "html",
            "extraction_prompt": (
                "Extract the article title, author name, publish date, "
                "and a 2-sentence summary of the main argument."
            ),
            "extraction_schema": {
                "type": "object",
                "properties": {
                    "title": {"type": "string"},
                    "author": {"type": "string"},
                    "published_date": {"type": "string"},
                    "summary": {"type": "string"}
                }
            }
        }
    )
    
    data = response.json()
    print(f"Model: {data['model_used']}")        # e.g. "gpt-4o-mini"
    print(f"Method: {data['extraction_method']}") # "llm"
    print(data["formats"]["json"])

    Provider Examples

    The provider is determined by which key you have registered. The extraction request syntax is identical regardless of provider — only the key registration differs.

    Use Case: Batch classification with Groq (high throughput)

    Python
    import asyncio
    import aiohttp
    
    API_KEY = "YOUR_ALTERLAB_KEY"
    
    async def classify(session, text):
        async with session.post(
            "https://api.alterlab.io/api/v1/extract",
            headers={"X-API-Key": API_KEY},
            json={
                "content": text,
                "content_type": "text",
                "extraction_prompt": (
                    "Classify this customer support message. "
                    "Determine the category, urgency, and whether it needs human review."
                ),
                "extraction_schema": {
                    "type": "object",
                    "properties": {
                        "category": {"type": "string"},
                        "urgency": {"type": "string"},
                        "needs_human": {"type": "boolean"}
                    }
                }
            }
        ) as resp:
            return await resp.json()
    
    async def main(tickets):
        async with aiohttp.ClientSession() as session:
            tasks = [classify(session, t) for t in tickets]
            return await asyncio.gather(*tasks)
    
    results = asyncio.run(main(ticket_texts))
    for r in results:
        print(r["formats"]["json"])  # {"category": "...", "urgency": "...", "needs_human": ...}

    Use Case: Deep analysis with Anthropic Claude

    Python
    # Claude excels at nuanced extraction with complex context
    response = requests.post(
        "https://api.alterlab.io/api/v1/extract",
        headers={"X-API-Key": "YOUR_ALTERLAB_KEY"},
        json={
            "content": legal_document_text,
            "content_type": "text",
            "extraction_prompt": (
                "Extract all contractual obligations from this document. "
                "For each obligation, identify: who is obligated, what they must do, "
                "the deadline if specified, and any penalties for non-compliance."
            ),
            "extraction_schema": {
                "type": "object",
                "properties": {
                    "obligations": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "party": {"type": "string"},
                                "obligation": {"type": "string"},
                                "deadline": {"type": "string"},
                                "penalty": {"type": "string"}
                            }
                        }
                    }
                }
            }
        }
    )
    
    result = response.json()
    print(f"Extracted by: {result['model_used']}")
    for ob in result["formats"]["json"]["obligations"]:
        print(f"- {ob['party']}: {ob['obligation']}")

    Best Practices

    Use algorithmic extraction first

    For HTML content with semantic structure (Schema.org, Open Graph, standard product markup), omit extraction_prompt and use extraction_schema or extraction_profile alone. This is 3x cheaper and deterministic.

    Always pair prompts with schemas

    LLM output without a schema may return inconsistent field names or types across calls. Adding extraction_schema forces typed, structured output that matches your data model.

    Write concise prompts

    Prompts are included in the LLM context window, which affects token cost. Keep prompts under 500 characters for simple extraction tasks. The 2,000 character limit is for genuinely complex multi-step reasoning.

    Truncate content before sending

    AlterLab truncates content to 30K characters before passing it to the LLM. For very large pages, extract the relevant section first to reduce token cost and improve extraction accuracy.

    Use field descriptions for disambiguation

    When your schema has fields with ambiguous names (e.g., value, name), add JSON Schema description to each field. The LLM uses these to resolve ambiguity.

    Monitor your provider usage

    Token costs accumulate independently on your provider account. Set spending limits directly with your provider (OpenAI, Anthropic usage limits, OpenRouter budget caps) to prevent unexpected costs.

    Extraction ProfilesOAuth2 Machine-to-Machine
    Last updated: June 2026

    On this page