Skip to main content
AI-Ready Energy Data

Commodity Data API for
AI & Machine Learning

Clean, structured energy price data optimized for LLM training, RAG applications, and ML models. Developer-friendly alternative to Bloomberg at 1/100th the cost.

5+ Years

Historical Data

50+

Commodities

JSON

Consistent Schema

$45/mo

vs $25K/yr Bloomberg

The Challenge for AI Teams

Expensive Data Licenses

Bloomberg/Refinitiv cost $25K+/year - overkill for training data

Inconsistent Formats

Scraping produces messy data requiring extensive cleaning

Not RAG-Optimized

Traditional APIs weren't designed for LLM context windows

Our Solution

Usage-Based Pricing

Start free, scale as needed - no $25K minimums

Consistent JSON Schema

Every response follows the same structure - no cleaning needed

LLM-Friendly Responses

Compact, semantic data that fits LLM context limits

AI & ML Use Cases

RAG Applications

  • • Build energy-aware chatbots
  • • Real-time price lookups via function calling
  • • Historical context for price questions
  • • Structured output for LLM parsing

Model Training

  • • 5+ years historical time series
  • • Consistent intervals (hourly/daily)
  • • Price forecasting models
  • • Volatility prediction

Data Pipelines

  • • Webhook triggers for new data
  • • Bulk historical downloads
  • • CSV and JSON formats
  • • Pandas-ready structure

Example: LLM Function Calling

OpenAI Function Definition

{
  "name": "get_oil_price",
  "description": "Get current or historical oil prices",
  "parameters": {
    "type": "object",
    "properties": {
      "commodity": {
        "type": "string",
        "enum": ["WTI", "BRENT", "NATURAL_GAS"]
      },
      "date": {
        "type": "string",
        "description": "YYYY-MM-DD or 'latest'"
      }
    }
  }
}

API Response (LLM-Ready)

{
  "commodity": "WTI",
  "price": 75.42,
  "currency": "USD",
  "unit": "barrel",
  "change_24h": -1.23,
  "change_percent": -1.6,
  "timestamp": "2024-01-15T14:30:00Z"
}

Python ML Example

import pandas as pd
from oilpriceapi import OilPriceAPI

api = OilPriceAPI('your-api-key')

# Get training data
data = api.prices.past_year(
    commodity='WTI',
    interval='daily'
)

# Convert to DataFrame
df = pd.DataFrame(data['prices'])
df['date'] = pd.to_datetime(df['timestamp'])

# Ready for model training
X = df[['open', 'high', 'low', 'volume']]
y = df['close']

LangChain Integration

from langchain.tools import tool

@tool
def get_oil_price(commodity: str) -> str:
    """Get current oil price for analysis."""
    response = requests.get(
        f"{'{'}API_URL{'}'}/v1/prices/latest",
        headers={"Authorization": f"Bearer {'{'}API_KEY{'}'}"}
    )
    data = response.json()
    price_data = data['data'][commodity]
    return f"{'{'}commodity{'}'}: ${'{'}price_data['price']{'}'}/barrel"

# Add to your agent
tools = [get_oil_price]

Why AI Teams Choose Us Over Bloomberg

FeatureOilPriceAPIBloomberg/Refinitiv
Pricing$45/month (50K requests)$25,000+/year
API FormatREST + JSON (LLM-ready)Proprietary protocols
Free Tier500 requests/monthNone
Setup Time5 minutesWeeks (contract + integration)
ML/AI ReadyPandas, NumPy compatibleRequires data transformation
Python SDKpip install oilpriceapiComplex SDK setup

Start Building with Energy Data

Get instant API access. No credit card required. Build your first AI integration in minutes.

Production Plan

$45/month

  • 50,000 API requests/month
  • 5+ years historical data
  • JSON & CSV formats
  • Python SDK included

No credit card required for free tier

AI & ML Data FAQ

Can I use this data for model training?

Yes, our data is licensed for internal use including ML model training. All paid plans include rights to use historical data for training forecasting models, classification systems, and other ML applications.

How much historical data is available?

Production plan includes 90 days of historical data. Reservoir Mastery plan includes 5+ years of historical data with hourly, daily, weekly, and monthly intervals - ideal for training time-series models.

Is the data suitable for RAG applications?

Absolutely. Our JSON responses are compact and consistently structured, making them ideal for LLM context injection. Each response includes metadata like timestamps and units that help LLMs provide accurate answers.

Do you support bulk data downloads?

Yes, our historical endpoints support pagination up to 500 records per request. You can also use CSV format for easier ingestion into data pipelines and ML frameworks like Pandas.