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
$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
- • 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"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
- 5+ years historical data
- 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