DEV Community

shashank ms
shashank ms

Posted on

Using LLM for Financial Analysis and Forecasting

Financial analysis depends on processing vast amounts of unstructured text. Earnings call transcripts, SEC filings, and macro research reports routinely run to hundreds of thousands of tokens, and effective forecasting requires models that can reason across long time horizons. Large language models have become capable analysts, but inference costs on traditional token-based platforms scale directly with input length. For teams running multi-document pipelines or agentic workflows, that cost structure creates friction. Oxlo.ai removes the variable by charging one flat rate per API request regardless of prompt size, which makes deep contextual analysis economically predictable.

The Cost Structure of Financial Workloads

Most AI inference providers bill by the token. Together AI, Fireworks AI, OpenRouter, Replicate, and Anyscale all use token-based meters, which means that feeding a model a 100,000-token 10-K filing or a decade of annual reports immediately multiplies your cost. For forecasting systems that compare multiple documents in a single prompt, or for agentic loops that pass long context histories back and forth, token bills compound quickly.

Oxlo.ai uses request-based pricing instead. One flat cost per API request covers any prompt length, so analyzing a 200,000-token document costs the same as a 2,000-token summary. For long-context financial workloads, this can be 10 to 100 times cheaper than token-based alternatives. Exact plan details are available at https://oxlo.ai/pricing.

Model Selection for Analysis and Forecasting

Not every financial task needs the same capability. Oxlo.ai hosts 45+ open-source and proprietary models across seven categories, all accessible through a single OpenAI-compatible endpoint at https://api.oxlo.ai/v1.

DeepSeek R1 671B MoE excels at deep reasoning and complex coding, making it a strong choice for building custom financial models or evaluating derivative logic. Llama 3.3 70B serves as a reliable general-purpose flagship for summarization and question answering. Qwen 3 32B offers multilingual reasoning and agent workflows for global portfolio analysis. Kimi K2.6 brings advanced reasoning, agentic coding, and vision to the table, backed by a 131K context window that can swallow entire filings in one pass. Kimi K2.5 and Kimi K2 Thinking provide advanced chain-of-thought reasoning for scenarios where you need to show your work. GLM 5, a 744B MoE, targets long-horizon agentic tasks, while Minimax M2.5 specializes in coding and agentic tool use. For coding-specific outputs, Qwen 3 Coder 30B, DeepSeek Coder, and Oxlo.ai Coder Fast are available. There are no cold starts on popular models, so latency stays consistent even during market open rushes.

Pipeline Design: Direct Context vs. Retrieval

When a document fits inside the context window, passing it directly eliminates retrieval errors and preserves numerical continuity across pages. Oxlo.ai's request-based pricing removes the usual penalty for long prompts, so you can stuff an entire earnings transcript or 10-K into a single call without watching the meter spin. If you are working with document libraries larger than the context limit, a hybrid approach works best: use an embedding model such as BGE-Large or E5-Large to retrieve relevant sections, then feed the top chunks to a reasoning model for synthesis.

Code Example: Streaming Analysis

Because Oxlo.ai is fully OpenAI SDK compatible, you can switch to it by changing two lines of configuration. The following example streams a sentiment and risk analysis of an earnings transcript:

import os
from openai import OpenAI

# Point the OpenAI SDK to Oxlo.ai
client = OpenAI(
    base_url="https://api.oxlo.ai/v1",
    api_key=os.environ["OXLO_API_KEY"]
)

transcript = """..."""  # Full earnings call text

response = client.chat.completions.create(
    model="kimi-k2-6",
    messages=[
        {"role": "system", "content": "You are a sell-side equity analyst."},
        {"role": "user", "content": f"Summarize guidance changes and material risks:\n\n{transcript}"}
    ],
    stream=True
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
Enter fullscreen mode Exit fullscreen mode

Structured Forecasting with JSON Mode

Quantitative forecasts need structure. Oxlo.ai supports JSON mode and function calling, so you can force a model to return revenue projections, confidence intervals, or risk scores in a machine-readable format. This makes it trivial to pipe LLM output into pandas, a BI tool, or a downstream Monte Carlo simulation.

import json

response = client.chat.completions.create(
    model="deepseek-r1-671b",
    messages=[
        {"role": "system", "content": "Return a JSON object with keys: revenue_forecast, confidence, risk_factors."},
        {"role": "user", "content": f"Project next quarter revenue based on this transcript:\n\n{transcript}"}
    ],
    response_format={"type": "json_object"}
)

forecast = json.loads(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Agentic Workflows and Tool Use

Financial analysis rarely stops at a single question. An agent might fetch the latest 10-K, calculate liquidity ratios by calling a Python interpreter, compare the results to industry benchmarks, and draft a memo. Models such as Kimi K2.6, GLM 5, and Minimax M2.5 support advanced agentic coding and tool use. Because Oxlo.ai bills per request rather than per token, you can run multi-turn agentic loops with long memory buffers without worrying that each additional reasoning step will explode your bill. Function calling is fully supported, and the platform is fully OpenAI SDK compatible, so existing agent frameworks like LangChain or AutoGen integrate with a single base_url change.

Vision and Multimodal Inputs

Financial data is not only text. Charts, balance sheet screenshots, and slide decks often contain signals that tables omit. Oxlo.ai supports vision inputs through models such as Gemma 3 27B and Kimi VL A3B, as well as Kimi K2.6. You can pass an image of a cash flow chart alongside a transcript and ask the model to reconcile discrepancies between the visual and the narrative. Vision endpoints use the same chat/completions interface and request-based pricing, so mixed-modality pipelines stay simple.

Getting Started

Oxlo.ai is built as a developer-first platform. The API is a drop-in replacement for the OpenAI SDK in Python, Node.js, or cURL. You can start on the Free plan, which includes 60 requests per day across 16+ models and a 7-day full-access trial. For production workloads, the Pro plan offers 1,000 requests per day across all models, while Premium provides 5,000 requests per day with priority queue access. Enterprise customers receive dedicated GPUs, unlimited requests, and guaranteed savings of 30% over their current provider. See https://oxlo.ai/pricing for current plan details.

Top comments (0)