Currency API for Python: 5 Best Exchange Rate APIs in 2026 (with Code)
The 5 best currency exchange rate APIs for Python in 2026, ranked — pip-installable SDKs, working code examples, free-tier limits and pricing for AllRatesToday, ExchangeRate-API, Frankfurter and more.
If you're building a Python app that needs exchange rates — whether it's a Django SaaS, a FastAPI
microservice, or a data science pipeline — you need an API that has a proper Python SDK, not just
a REST endpoint you call with requests. This guide ranks the best options by Python
developer experience, pricing, and data quality.
Quick Comparison
| Provider | Python SDK | Free Tier | Update Frequency | Currencies | Starting Price |
|---|---|---|---|---|---|
| AllRatesToday | pip install allratestoday | Free | 60 seconds | 160+ | Free / €4.99/mo |
| ExchangeRate-API | No official SDK | 1,500 req/mo | Daily | 161 | Free / $9.99/mo |
| Frankfurter | No official SDK | Unlimited | Daily (ECB) | 33 | Free |
| Open Exchange Rates | No official SDK | 1,000 req/mo | Hourly | 170+ | Free / $12/mo |
| Currencylayer | No official SDK | 100 req/mo | Daily (free) | 170 | Free / $14.99/mo |
1. AllRatesToday
AllRatesToday is the only provider on this list with an official, typed Python SDK published on PyPI.
Install with pip install allratestoday and you get auto-completion, type hints, and
built-in error handling. Rates are mid-market from institutional foreign exchange market data, updated every 60 seconds.
pip install allratestoday
from allratestoday import AllRatesToday
client = AllRatesToday(api_key="art_live_your_key")
# Current rate
rate = client.get_rate("USD", "EUR")
print(f"1 USD = {rate['rate']} EUR")
# Historical rates (last 30 days, paid plan)
history = client.get_historical_rates("USD", "EUR", period="30d")
for point in history["rates"]:
print(f"{point['time']}: {point['rate']}")Pros
- Official Python SDK with type hints
- Real-time rates (60s updates)
- Mid-market rates, no markup
- Any base currency on all plans
- Free tier, no credit card
Cons
- History and commercial use are included on every paid plan from €4.99/month
- No crypto or precious metals in the core API
2. ExchangeRate-API
Popular for its generous free tier (1,500 requests/month). No official Python SDK — you use
requests or httpx directly. Rates update once daily on the free plan.
Good for hobby projects that don't need real-time data.
import requests
resp = requests.get("https://v6.exchangerate-api.com/v6/YOUR_KEY/latest/USD")
data = resp.json()
print(f"USD to EUR: {data['conversion_rates']['EUR']}")Pros
- 1,500 free requests/month
- Simple JSON response
- Well-documented
Cons
- No official Python SDK
- Daily updates only on free tier
- USD-only base on free plan
3. Frankfurter
Open-source API backed by ECB reference rates. Completely free with no API key required. Only covers 33 currencies and updates once daily. Best for EU-focused projects that only need major currencies.
import requests
resp = requests.get("https://api.frankfurter.dev/v1/latest?base=USD&symbols=EUR,GBP")
data = resp.json()
print(data["rates"])Pros
- Completely free, no API key
- Open-source
- No rate limits
Cons
- Only 33 currencies
- Daily updates only (ECB)
- No commercial SLA
4. Open Exchange Rates
One of the oldest currency APIs. Hourly updates on paid plans. No official Python SDK, but the REST API is straightforward. Free tier is USD-base only with 1,000 requests/month.
Pros
- Established since 2012
- Hourly updates on paid plans
- 170+ currencies
Cons
- No official Python SDK
- USD-only on free/cheap plans
- $12/mo starting price
5. Currencylayer
Part of the Apilayer ecosystem. Only 100 free requests/month with daily updates. Real-time data requires the Professional plan ($39.99/mo). No Python SDK.
Pros
- 170 currencies
- Part of Apilayer marketplace
Cons
- Only 100 free requests/month
- Real-time requires $39.99/mo
- No Python SDK
Using Exchange Rates in Pandas and Data Science
If you work with data in Python, you probably use pandas. Here is how to pull exchange rate data into a DataFrame using AllRatesToday:
import pandas as pd
from allratestoday import AllRatesToday
client = AllRatesToday("YOUR_API_KEY")
# Get historical rates for the past 90 days
history = client.get_historical_rates("USD", "EUR", "90d")
# Convert to DataFrame
df = pd.DataFrame(history["rates"])
df["time"] = pd.to_datetime(df["time"])
df.set_index("time", inplace=True)
# Basic statistics
print(df.describe())
print(f"\nAverage rate: {df['rate'].mean():.4f}")
print(f"Min rate: {df['rate'].min():.4f}")
print(f"Max rate: {df['rate'].max():.4f}")
print(f"Volatility (std): {df['rate'].std():.4f}")Plotting exchange rate trends
import matplotlib.pyplot as plt
df["rate"].plot(
figsize=(12, 6),
title="USD/EUR Exchange Rate - Last 90 Days",
ylabel="Rate",
color="#2ed06e",
linewidth=2
)
plt.tight_layout()
plt.savefig("usd_eur_trend.png", dpi=150)
plt.show()Django Integration Example
A common use case is displaying localized prices in a Django e-commerce application. Here is a reusable utility:
# pricing/exchange.py
from allratestoday import AllRatesToday
from django.conf import settings
from django.core.cache import cache
client = AllRatesToday(settings.ALLRATESTODAY_API_KEY)
def get_exchange_rate(source: str, target: str) -> float:
"""Get exchange rate with 5-minute cache."""
cache_key = f"fx_rate_{source}_{target}"
rate = cache.get(cache_key)
if rate is None:
rate = client.get_rate(source, target)
cache.set(cache_key, rate, timeout=300) # Cache for 5 minutes
return rate
def convert_price(amount: float, source: str, target: str) -> float:
"""Convert a price from one currency to another."""
rate = get_exchange_rate(source, target)
return round(amount * rate, 2)# In your Django view or template tag
from pricing.exchange import convert_price
# Convert $99.99 USD to EUR
price_eur = convert_price(99.99, "USD", "EUR")
print(f"€{price_eur}")Flask Microservice Example
Build a lightweight currency conversion endpoint with Flask:
from flask import Flask, request, jsonify
from allratestoday import AllRatesToday
app = Flask(__name__)
client = AllRatesToday("YOUR_API_KEY")
@app.route("/convert")
def convert():
source = request.args.get("from", "USD")
target = request.args.get("to", "EUR")
amount = float(request.args.get("amount", 1))
result = client.convert(source, target, amount)
return jsonify({
"from": source,
"to": target,
"amount": amount,
"converted": result["result"],
"rate": result["rate"],
"timestamp": result["time"]
})
if __name__ == "__main__":
app.run(debug=True)Test it:
curl "http://localhost:5000/convert?from=USD&to=EUR&amount=500" FastAPI Async Example
For async Python applications, you can use httpx with the AllRatesToday REST API:
from fastapi import FastAPI
import httpx
app = FastAPI()
API_KEY = "YOUR_API_KEY"
@app.get("/rate/{source}/{target}")
async def get_rate(source: str, target: str):
async with httpx.AsyncClient() as http:
response = await http.get(
"https://allratestoday.com/api/v1/rates",
params={"source": source, "target": target},
headers={"Authorization": f"Bearer {API_KEY}"}
)
data = response.json()
return {
"source": source,
"target": target,
"rate": data["rate"],
"time": data["time"]
}Our Verdict
For Python developers, AllRatesToday is the clear winner. It's the only provider
with an official pip install SDK, type hints, and real-time data on the free tier.
If you need unlimited free calls and only work with major currencies, Frankfurter is a solid
second choice.
Start building in Python
pip install allratestoday — free tier, no credit card.