Skip to main content

🐙 open-octopus

An Octopus Energy API client built for AI.


PyPI version Python License


pip install open-octopus

Features · Quick Start · CLI · AI Agent · API Reference




Features

⚡ Live Power

Real-time consumption from Home Mini.

See exactly what you're using right now. Updates every 10-30 seconds. Calculate cost per hour at current rates.

🔌 Smart Charging

Intelligent Octopus dispatch slots.

Know when your EV is charging. See upcoming charge windows. Never miss off-peak rates again.

🎁 Saving Sessions

Free electricity events.

Get notified about upcoming free power events. Track rewards in Octopoints. Never miss free energy.

🔥 Dual Fuel

Electricity + gas support.

Track both meters. Get consumption history. See tariff details for gas and electric.

🤖 AI Agent

Ask questions in plain English.

"What's my current rate?" "How much did I use yesterday?" Powered by Claude.

🖥️ Menu Bar

macOS status bar app.

Live power, current rate, charging status, and balance. Always visible. One click away.




Quick Start

⚡ Basic Usage

import asyncio
from open_octopus import OctopusClient

async def main():
    async with OctopusClient(
        api_key="sk_live_xxx",
        account="A-XXXXXXXX"
    ) as client:
        # Account balance
        account = await client.get_account()
        print(f"Balance: £{account.balance:.2f}")

        # Current rate
        tariff = await client.get_tariff()
        rate = client.get_current_rate(tariff)
        print(f"Rate: {rate.rate}p/kWh")

        # Live power (Home Mini)
        power = await client.get_live_power()
        if power:
            print(f"Power: {power.demand_kw:.2f} kW")

asyncio.run(main())

🔥 With Gas

async with OctopusClient(
    api_key="sk_live_xxx",
    account="A-XXXXXXXX",
    gas_mprn="1234567890",
    gas_meter_serial="G4A12345"
) as client:
    # Gas consumption
    gas = await client.get_daily_gas_usage(days=7)
    for date, kwh in gas.items():
        print(f"{date}: {kwh:.1f} kWh")

    # Gas tariff
    tariff = await client.get_gas_tariff()
    print(f"Rate: {tariff.unit_rate}p/kWh")



💻 CLI

octopus status      # Full overview
octopus rate        # Current rate (off-peak/peak)
octopus power       # Live consumption
octopus dispatch    # Charging windows
octopus usage       # Electricity usage
octopus gas         # Gas usage
octopus sessions    # Saving sessions
octopus watch       # Live monitoring



🤖 AI Agent

Ask questions about your energy in plain English.

pip install 'open-octopus[agent]'
export ANTHROPIC_API_KEY="sk-ant-xxx"

octopus-ask "What's my current rate?"
octopus-ask "How much gas did I use this week?"
octopus-ask "When is my next charging window?"
octopus-ask "Am I on off-peak rates right now?"

Or use in Python:

from open_octopus import OctopusAgent

agent = OctopusAgent()
response = await agent.ask("What's my balance?")
print(response)



🖥️ Menu Bar (macOS)

pip install 'open-octopus[menubar]'
octopus-menubar
⚡
Live Power
Real-time kW
🌙
Rate Status
Off-peak/peak
🔌
Charging
EV dispatch
💰
Balance
Account credit



📚 API Reference

Account & Billing

get_account()           # Balance, status, address
get_tariff()            # Electricity tariff
get_gas_tariff()        # Gas tariff
get_current_rate()      # Current rate + off-peak

Consumption

get_consumption()       # Half-hourly readings
get_daily_usage()       # Daily totals
get_gas_consumption()   # Gas readings
get_daily_gas_usage()   # Daily gas totals

Smart Features

get_live_power()        # Real-time watts
get_dispatches()        # Charge windows
get_dispatch_status()   # Currently charging?
get_saving_sessions()   # Free power events

Models

Account                 # Balance, name, status
Tariff / GasTariff      # Rates, standing charge
Rate                    # Current rate, period
Dispatch                # Charge window
LivePower               # Real-time demand
SavingSession           # Free power event



⚙️ Configuration

Environment Variables
# Required
OCTOPUS_API_KEY=sk_live_xxx
OCTOPUS_ACCOUNT=A-XXXXXXXX

# Electricity meter (optional)
OCTOPUS_MPAN=1234567890123
OCTOPUS_METER_SERIAL=12A3456789

# Gas meter (optional)
OCTOPUS_GAS_MPRN=1234567890
OCTOPUS_GAS_METER_SERIAL=G4A12345

# AI agent (optional)
ANTHROPIC_API_KEY=sk-ant-xxx
Getting Your API Key
  1. Log in to Octopus Energy
  2. Go to Developer Settings
  3. Copy your API key (starts with sk_live_)
Finding Your MPAN/MPRN

Your MPAN (electricity) and MPRN (gas) are on your energy bills.

Or discover them via the API:

account = await client.get_account()
print(account)  # Includes meter info



How It Works

┌────────────────────────────────────────────────────────────────┐
│  Octopus Energy GraphQL API (Kraken)                           │
│  ↓                                                             │
│  open-octopus async client                                     │
│  • Account balance, tariffs                                    │
│  • Consumption data (electricity + gas)                        │
│  • Intelligent Octopus dispatches                              │
│  • Live power (Home Mini telemetry)                            │
│  • Saving Sessions                                             │
│  ↓                                                             │
│  Your choice of interface                                      │
│  • Python library (async/await)                                │
│  • CLI tool (octopus)                                          │
│  • AI agent (octopus-ask)                                      │
│  • Menu bar app (octopus-menubar)                              │
└────────────────────────────────────────────────────────────────┘



Built for Octopus Energy customers 🐙

Report Bug · Request Feature


MIT License · Octopus Energy · GraphQL API

Metadata

Release files for open-octopus 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-octopus 0.3.0
File Size Uploaded
open_octopus-0.3.0.tar.gz 20.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for open-octopus 0.3.0
File Interpreter ABI Platform
open_octopus-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.9 kB

Release files / open_octopus-0.3.0.tar.gz

Download URL open_octopus-0.3.0.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04b9de01fa37e6656ba78d29fde54389500ade892c3535125b6cdb8033f3445b
BLAKE2b-256 checksum
How to use checksums
0a67f30547a0278c17362dce17f0dda2e966dc6c58f947c0c3e05515780bc391
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.

Transparency log

Release files / open_octopus-0.3.0-py3-none-any.whl

Download URL open_octopus-0.3.0-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f17dc9b05bbb46e15eee34746d97e3a7c9bbee7faccbac55f7fc2b90f69a958
BLAKE2b-256 checksum
How to use checksums
ea48d4524980db6b0502599fbf7c1fa8df8d8a93a1d428ba82ed18eaead5f6e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page