CodeCarbon Runs API

The Runs API from CodeCarbon — 5 operation(s) for runs.

GitHub OpenAPI

Operations 6

POST /runs Add Run #
GET /runs List Runs #
GET /runs/{run_id} Read Run #
GET /experiments/{experiment_id}/runs Read Runs From Experiment #
GET /experiments/{experiment_id}/runs/sums Read Experiment Detailed Sums By Run #
GET /lastrun/project/{project_id} Read Project Last Run #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/codecarbon:codecarbon-runs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

codecarbon-runs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Codecarbon Runs API
  version: 0.1.0
  x-refined-note:
  - x-original-title differs across the merged source definitions and was not carried
  description: 'Operations tagged Runs across 2 of this provider''s published API definitions: codecarbon-openapi.json, codecarbon-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: /api/
- url: https://api.codecarbon.io/api
  description: Resolved from the relative server /api/ as served at https://api.codecarbon.io/openapi.json
tags:
- name: Runs
paths:
  /runs:
    post:
      tags:
      - Runs
      summary: Add Run
      operationId: add_run_runs_post
      parameters:
      - name: x-api-token
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Api-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Runs
      summary: List Runs
      operationId: list_runs_runs_get
      security:
      - APIKeyCookie: []
      - HTTPBearer: []
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Run'
                title: Response List Runs Runs Get
    servers:
    - url: /api/
  /runs/{run_id}:
    get:
      tags:
      - Runs
      summary: Read Run
      operationId: read_run_runs__run_id__get
      security:
      - APIKeyCookie: []
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: string
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    servers:
    - url: /api/
  /experiments/{experiment_id}/runs:
    get:
      tags:
      - Runs
      summary: Read Runs From Experiment
      operationId: read_runs_from_experiment_experiments__experiment_id__runs_get
      security:
      - APIKeyCookie: []
      - HTTPBearer: []
      parameters:
      - name: experiment_id
        in: path
        required: true
        schema:
          type: string
          title: Experiment Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    servers:
    - url: /api/
  /experiments/{experiment_id}/runs/sums:
    get:
      tags:
      - Runs
      summary: Read Experiment Detailed Sums By Run
      operationId: read_experiment_detailed_sums_by_run_experiments__experiment_id__runs_sums_get
      security:
      - APIKeyCookie: []
      - HTTPBearer: []
      parameters:
      - name: experiment_id
        in: path
        required: true
        schema:
          type: string
          title: Experiment Id
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RunReport'
                title: Response Read Experiment Detailed Sums By Run Experiments  Experiment Id  Runs Sums Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    servers:
    - url: /api/
  /lastrun/project/{project_id}:
    get:
      tags:
      - Runs
      summary: Read Project Last Run
      operationId: read_project_last_run_lastrun_project__project_id__get
      security:
      - APIKeyCookie: []
      - HTTPBearer: []
      parameters:
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          title: Project Id
      - name: start_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Start Date
      - name: end_date
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: End Date
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Run'
                - $ref: '#/components/schemas/Empty'
                title: Response Read Project Last Run Lastrun Project  Project Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    servers:
    - url: /api/
components:
  schemas:
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    RunReport:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        experiment_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Experiment Id
        os:
          anyOf:
          - type: string
          - type: 'null'
          title: Os
        python_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Python Version
        codecarbon_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Codecarbon Version
        cpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Cpu Count
        cpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Cpu Model
        gpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Gpu Count
        gpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Gpu Model
        longitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Longitude
        latitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Latitude
        region:
          anyOf:
          - type: string
          - type: 'null'
          title: Region
        provider:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
        ram_total_size:
          anyOf:
          - type: number
          - type: 'null'
          title: Ram Total Size
        tracking_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Tracking Mode
        run_id:
          type: string
          format: uuid
          title: Run Id
        emissions:
          type: number
          title: Emissions
        cpu_power:
          type: number
          title: Cpu Power
        gpu_power:
          type: number
          title: Gpu Power
        ram_power:
          type: number
          title: Ram Power
        cpu_energy:
          type: number
          title: Cpu Energy
        gpu_energy:
          type: number
          title: Gpu Energy
        ram_energy:
          type: number
          title: Ram Energy
        energy_consumed:
          type: number
          title: Energy Consumed
        duration:
          type: number
          title: Duration
        emissions_rate:
          type: number
          title: Emissions Rate
        emissions_count:
          type: integer
          title: Emissions Count
        cpu_utilization_percent:
          anyOf:
          - type: number
          - type: 'null'
          title: Cpu Utilization Percent
        gpu_utilization_percent:
          anyOf:
          - type: number
          - type: 'null'
          title: Gpu Utilization Percent
        ram_utilization_percent:
          anyOf:
          - type: number
          - type: 'null'
          title: Ram Utilization Percent
      type: object
      required:
      - timestamp
      - run_id
      - emissions
      - cpu_power
      - gpu_power
      - ram_power
      - cpu_energy
      - gpu_energy
      - ram_energy
      - energy_consumed
      - duration
      - emissions_rate
      - emissions_count
      title: RunReport
      example:
        codecarbon_version: 2.1.3
        cpu_count: 12
        cpu_model: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
        experiment_id: 8edb03e1-9a28-452a-9c93-a3b6560136d7
        gpu_count: 4
        gpu_model: NVIDIA
        latitude: 33.5822
        longitude: -7.6174
        os: macOS-10.15.7-x86_64-i386-64bit
        provider: AWS
        python_version: 3.8.0
        ram_total_size: 83948.22
        region: EUROPE
        timestamp: '2021-04-04T08:43:00+02:00'
        tracking_mode: Machine
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Empty:
      properties: {}
      additionalProperties: false
      type: object
      title: Empty
    Run:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        experiment_id:
          type: string
          format: uuid
          title: Experiment Id
        os:
          anyOf:
          - type: string
          - type: 'null'
          title: Os
        python_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Python Version
        codecarbon_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Codecarbon Version
        cpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Cpu Count
        cpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Cpu Model
        gpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Gpu Count
        gpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Gpu Model
        longitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Longitude
        latitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Latitude
        region:
          anyOf:
          - type: string
          - type: 'null'
          title: Region
        provider:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
        ram_total_size:
          anyOf:
          - type: number
          - type: 'null'
          title: Ram Total Size
        tracking_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Tracking Mode
        id:
          type: string
          format: uuid
          title: Id
      type: object
      required:
      - timestamp
      - experiment_id
      - id
      title: Run
      example:
        codecarbon_version: 2.1.3
        cpu_count: 12
        cpu_model: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
        experiment_id: 8edb03e1-9a28-452a-9c93-a3b6560136d7
        gpu_count: 4
        gpu_model: NVIDIA
        latitude: 33.5822
        longitude: -7.6174
        os: macOS-10.15.7-x86_64-i386-64bit
        provider: AWS
        python_version: 3.8.0
        ram_total_size: 83948.22
        region: EUROPE
        timestamp: '2021-04-04T08:43:00+02:00'
        tracking_mode: Machine
    RunCreate:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        experiment_id:
          type: string
          format: uuid
          title: Experiment Id
        os:
          anyOf:
          - type: string
          - type: 'null'
          title: Os
        python_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Python Version
        codecarbon_version:
          anyOf:
          - type: string
          - type: 'null'
          title: Codecarbon Version
        cpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Cpu Count
        cpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Cpu Model
        gpu_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Gpu Count
        gpu_model:
          anyOf:
          - type: string
          - type: 'null'
          title: Gpu Model
        longitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Longitude
        latitude:
          anyOf:
          - type: number
          - type: 'null'
          title: Latitude
        region:
          anyOf:
          - type: string
          - type: 'null'
          title: Region
        provider:
          anyOf:
          - type: string
          - type: 'null'
          title: Provider
        ram_total_size:
          anyOf:
          - type: number
          - type: 'null'
          title: Ram Total Size
        tracking_mode:
          anyOf:
          - type: string
          - type: 'null'
          title: Tracking Mode
      type: object
      required:
      - timestamp
      - experiment_id
      title: RunCreate
      example:
        codecarbon_version: 2.1.3
        cpu_count: 12
        cpu_model: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
        experiment_id: 8edb03e1-9a28-452a-9c93-a3b6560136d7
        gpu_count: 4
        gpu_model: NVIDIA
        latitude: 33.5822
        longitude: -7.6174
        os: macOS-10.15.7-x86_64-i386-64bit
        provider: AWS
        python_version: 3.8.0
        ram_total_size: 83948.22
        region: EUROPE
        timestamp: '2021-04-04T08:43:00+02:00'
        tracking_mode: Machine
  securitySchemes:
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: user_session
    HTTPBearer:
      type: http
      scheme: bearer
x-refined-from:
- codecarbon-openapi.json
- codecarbon-openapi.yml