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.
Varies
History by Series
Broad
Energy Catalog
JSON
Consistent Schema
$19/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
- • Historical time series where available
- • 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: one year of daily WTI prices
data = api.historical.get(
'WTI_USD',
interval='daily',
per_page=365
)
# Convert to DataFrame
df = pd.DataFrame([p.model_dump() for p in data.data])
df['date'] = pd.to_datetime(df['date'])
# Ready for model training: predict the next day's price
df = df.sort_values('date')
df['next_value'] = df['value'].shift(-1)
df = df.dropna(subset=['next_value'])
X = df[['value']]
y = df['next_value']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"Token {'{'}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
| Feature | OilPriceAPI | Bloomberg/Refinitiv |
|---|---|---|
| Pricing | $19/month (10K requests) | $25,000+/year |
| API Format | REST + JSON (LLM-ready) | Proprietary protocols |
| Free Tier | 10,000 API requests (7-day trial) | None |
| Setup Time | 5 minutes | Weeks (contract + integration) |
| ML/AI Ready | Pandas, NumPy compatible | Requires data transformation |
| Python SDK | pip install oilpriceapi | Complex SDK setup |
Start Building with Energy Data
Get instant API access. No credit card required. Build your first AI integration in minutes.
Starter Plan
$49/month
- 50,000 API requests/month
- Historical data where available
- JSON & CSV formats
- Python SDK included
Starting smaller? The Developer plan is $19/month for 10,000 requests — compare all plans.
No credit card required for free tier