diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2022-2023 Simon Hengel <sol@typeful.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,3 @@
+#!/usr/bin/env runhaskell
+> import Distribution.Simple
+> main = defaultMain
diff --git a/hspec-api.cabal b/hspec-api.cabal
new file mode 100644
--- /dev/null
+++ b/hspec-api.cabal
@@ -0,0 +1,59 @@
+cabal-version: 1.12
+
+-- This file has been generated from package.yaml by hpack version 0.35.2.
+--
+-- see: https://github.com/sol/hpack
+
+name:           hspec-api
+version:        2.8.0
+synopsis:       A Testing Framework for Haskell
+description:    This package provides a stable API that can be used to extend Hspec's functionality.
+category:       Testing
+stability:      stable
+homepage:       https://hspec.github.io/
+bug-reports:    https://github.com/hspec/hspec/issues
+maintainer:     Simon Hengel <sol@typeful.net>
+copyright:      (c) 2022-2023 Simon Hengel
+license:        MIT
+license-file:   LICENSE
+build-type:     Simple
+
+source-repository head
+  type: git
+  location: https://github.com/hspec/hspec
+  subdir: hspec-api
+
+library
+  exposed-modules:
+      Test.Hspec.Api.Format.V1
+      Test.Hspec.Api.Formatters.V1
+      Test.Hspec.Api.Formatters.V2
+  other-modules:
+      Paths_hspec_api
+  hs-source-dirs:
+      src
+  ghc-options: -Wall
+  build-depends:
+      base ==4.*
+    , hspec-core >=2.8.0 && <2.11
+  default-language: Haskell2010
+
+test-suite spec
+  type: exitcode-stdio-1.0
+  main-is: Spec.hs
+  other-modules:
+      Test.Hspec.Api.Format.V1Spec
+      Test.Hspec.Api.Formatters.V1Spec
+      Test.Hspec.Api.Formatters.V2Spec
+      Paths_hspec_api
+  hs-source-dirs:
+      test
+  ghc-options: -Wall
+  build-tool-depends:
+      hspec-discover:hspec-discover
+  build-depends:
+      base ==4.*
+    , hspec ==2.*
+    , hspec-api
+    , hspec-core >=2.8.0 && <2.11
+  default-language: Haskell2010
diff --git a/src/Test/Hspec/Api/Format/V1.hs b/src/Test/Hspec/Api/Format/V1.hs
new file mode 100644
--- /dev/null
+++ b/src/Test/Hspec/Api/Format/V1.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ViewPatterns #-}
+-- |
+-- Stability: stable
+module Test.Hspec.Api.Format.V1 (
+  Format
+, FormatConfig(..)
+, Event(..)
+, Progress
+, Path
+, Location(..)
+, Seconds(..)
+, Item(..)
+, Result(..)
+, FailureReason(..)
+, monadic
+
+-- * Register a formatter
+, useFormatter
+, liftFormatter
+
+-- * Re-exports
+, Config
+) where
+
+import           Test.Hspec.Core.Runner
+import           Test.Hspec.Core.Format hiding (FormatConfig(..))
+import qualified Test.Hspec.Core.Format as Latest
+
+-- |
+-- Make a formatter available for use with @--format@ and use it by default.
+useFormatter :: (String, FormatConfig -> IO Format) -> Config -> Config
+useFormatter (liftFormatter -> formatter@(_, format)) config = (registerFormatter_ formatter config) { configFormat = Just format }
+
+-- copy of Test.Hspec.Core.Runner.registerFormatter
+registerFormatter_ :: (String, Latest.FormatConfig -> IO Latest.Format) -> Config -> Config
+#if MIN_VERSION_hspec_core(2,9,0)
+registerFormatter_ formatter config = config { configAvailableFormatters = formatter : configAvailableFormatters config }
+#else
+registerFormatter_ _ config = config
+#endif
+
+-- | Make a formatter compatible with types from "Test.Hspec.Core.Format".
+liftFormatter :: (String, FormatConfig -> IO Format) -> (String, Latest.FormatConfig -> IO Format)
+liftFormatter = fmap liftFormat
+  where
+    liftFormat :: (FormatConfig -> IO Format) -> Latest.FormatConfig -> IO Format
+    liftFormat format = format . liftFormatConfig
+
+data FormatConfig = FormatConfig {
+  formatConfigUseColor :: Bool
+, formatConfigUseDiff :: Bool
+, formatConfigPrintTimes :: Bool
+, formatConfigHtmlOutput :: Bool
+, formatConfigPrintCpuTime :: Bool
+, formatConfigUsedSeed :: Integer
+, formatConfigExpectedTotalCount :: Int
+}
+
+liftFormatConfig :: Latest.FormatConfig -> FormatConfig
+liftFormatConfig config = FormatConfig {
+  formatConfigUseColor = Latest.formatConfigUseColor config
+, formatConfigUseDiff = Latest.formatConfigUseDiff config
+, formatConfigPrintTimes = Latest.formatConfigPrintTimes config
+, formatConfigHtmlOutput = Latest.formatConfigHtmlOutput config
+, formatConfigPrintCpuTime = Latest.formatConfigPrintCpuTime config
+, formatConfigUsedSeed = Latest.formatConfigUsedSeed config
+#if MIN_VERSION_hspec_core(2,9,0)
+, formatConfigExpectedTotalCount = Latest.formatConfigExpectedTotalCount config
+#else
+, formatConfigExpectedTotalCount = Latest.formatConfigItemCount config
+#endif
+}
diff --git a/src/Test/Hspec/Api/Formatters/V1.hs b/src/Test/Hspec/Api/Formatters/V1.hs
new file mode 100644
--- /dev/null
+++ b/src/Test/Hspec/Api/Formatters/V1.hs
@@ -0,0 +1,99 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ViewPatterns #-}
+-- |
+-- Stability: deprecated
+--
+-- This module contains formatters that can be used with `hspecWith`:
+--
+-- @
+-- import Test.Hspec
+-- import Test.Hspec.Api.Formatters.V1
+--
+-- main :: IO ()
+-- main = hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) spec
+--
+-- formatter :: Formatter
+-- formatter = ...
+--
+-- spec :: Spec
+-- spec = ...
+-- @
+module Test.Hspec.Api.Formatters.V1 (
+
+-- * Register a formatter
+  useFormatter
+, formatterToFormat
+
+-- * Formatters
+, silent
+, checks
+, specdoc
+, progress
+, failed_examples
+
+-- * Implementing a custom Formatter
+-- |
+-- A formatter is a set of actions.  Each action is evaluated when a certain
+-- situation is encountered during a test run.
+--
+-- Actions live in the `FormatM` monad.  It provides access to the runner state
+-- and primitives for appending to the generated report.
+, Formatter (..)
+, FailureReason (..)
+, FormatM
+
+-- ** Accessing the runner state
+, getSuccessCount
+, getPendingCount
+, getFailCount
+, getTotalCount
+
+, FailureRecord (..)
+, getFailMessages
+, usedSeed
+
+, Seconds(..)
+, getCPUTime
+, getRealTime
+
+-- ** Appending to the generated report
+, write
+, writeLine
+, writeTransient
+
+-- ** Dealing with colors
+, withInfoColor
+, withSuccessColor
+, withPendingColor
+, withFailColor
+
+, useDiff
+, extraChunk
+, missingChunk
+
+-- ** Helpers
+, formatException
+
+-- * Re-exports
+, Location(..)
+, Progress
+
+, Config
+) where
+
+import Test.Hspec.Core.Formatters.V1
+import Test.Hspec.Core.Runner
+import Test.Hspec.Core.Format
+
+-- |
+-- Make a formatter available for use with @--format@ and use it by default.
+useFormatter :: (String, Formatter) -> Config -> Config
+useFormatter (fmap formatterToFormat -> formatter@(_, format)) config = (registerFormatter_ formatter config) { configFormat = Just format }
+
+-- copy of Test.Hspec.Core.Runner.registerFormatter
+registerFormatter_ :: (String, FormatConfig -> IO Format) -> Config -> Config
+#if MIN_VERSION_hspec_core(2,9,0)
+registerFormatter_ formatter config = config { configAvailableFormatters = formatter : configAvailableFormatters config }
+#else
+registerFormatter_ _ config = config
+#endif
diff --git a/src/Test/Hspec/Api/Formatters/V2.hs b/src/Test/Hspec/Api/Formatters/V2.hs
new file mode 100644
--- /dev/null
+++ b/src/Test/Hspec/Api/Formatters/V2.hs
@@ -0,0 +1,120 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ViewPatterns #-}
+-- |
+-- Stability: stable
+--
+-- This module contains formatters that can be used with `hspecWith`:
+--
+-- @
+-- import Test.Hspec
+-- import Test.Hspec.Api.Formatters.V1
+--
+-- main :: IO ()
+-- main = hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) spec
+--
+-- formatter :: Formatter
+-- formatter = ...
+--
+-- spec :: Spec
+-- spec = ...
+-- @
+module Test.Hspec.Api.Formatters.V2 (
+
+-- * Register a formatter
+  useFormatter
+, formatterToFormat
+
+-- * Formatters
+, silent
+, checks
+, specdoc
+, progress
+, failed_examples
+
+-- * Implementing a custom Formatter
+-- |
+-- A formatter is a set of actions.  Each action is evaluated when a certain
+-- situation is encountered during a test run.
+--
+-- Actions live in the `FormatM` monad.  It provides access to the runner state
+-- and primitives for appending to the generated report.
+, Formatter (..)
+, Path
+, Progress
+, Location(..)
+, Item(..)
+, Result(..)
+, FailureReason (..)
+, FormatM
+
+-- ** Accessing the runner state
+, getSuccessCount
+, getPendingCount
+, getFailCount
+, getTotalCount
+
+, FailureRecord (..)
+, getFailMessages
+, usedSeed
+
+, printTimes
+
+, Seconds(..)
+, getCPUTime
+, getRealTime
+
+-- ** Appending to the generated report
+, write
+, writeLine
+, writeTransient
+
+-- ** Dealing with colors
+, withInfoColor
+, withSuccessColor
+, withPendingColor
+, withFailColor
+
+, useDiff
+, diffContext
+, externalDiffAction
+, prettyPrint
+, extraChunk
+, missingChunk
+
+-- ** Helpers
+, formatLocation
+, formatException
+
+-- * Re-exports
+, Config
+) where
+
+import Test.Hspec.Core.Formatters.V2
+import Test.Hspec.Core.Runner (Config(..))
+import Test.Hspec.Core.Format
+
+#if !MIN_VERSION_hspec_core(2,10,6)
+diffContext :: FormatM (Maybe Int)
+diffContext = return Nothing
+
+externalDiffAction :: FormatM (Maybe (String -> String -> IO ()))
+externalDiffAction = return Nothing
+#endif
+
+-- |
+-- Make a formatter available for use with @--format@ and use it by default.
+useFormatter :: (String, Formatter) -> Config -> Config
+useFormatter (fmap formatterToFormat -> formatter@(_, format)) config = (registerFormatter_ formatter config) { configFormat = Just format }
+
+-- copy of Test.Hspec.Core.Runner.registerFormatter
+registerFormatter_ :: (String, FormatConfig -> IO Format) -> Config -> Config
+#if MIN_VERSION_hspec_core(2,9,0)
+registerFormatter_ formatter config = config { configAvailableFormatters = formatter : configAvailableFormatters config }
+#else
+registerFormatter_ _ config = config
+#endif
+
+#if !MIN_VERSION_hspec_core(2,9,2)
+prettyPrint :: FormatM Bool
+prettyPrint = return True
+#endif
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,1 @@
+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
diff --git a/test/Test/Hspec/Api/Format/V1Spec.hs b/test/Test/Hspec/Api/Format/V1Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/Hspec/Api/Format/V1Spec.hs
@@ -0,0 +1,22 @@
+module Test.Hspec.Api.Format.V1Spec (spec) where
+
+import           Test.Hspec
+import           Test.Hspec.Runner
+
+import           Data.IORef
+
+import           Test.Hspec.Api.Format.V1
+
+spec :: Spec
+spec = do
+  describe "useFormatter" $ do
+    it "sets a formatter to be used with a given config" $ do
+      ref <- newIORef "NAY!"
+      let
+        formatter :: Format
+        formatter event = case event of
+          ItemDone {} -> writeIORef ref "YAY!"
+          _ -> return ()
+
+      hspecWith (useFormatter ("my-formatter", \ _ -> return formatter) defaultConfig) $ it "" True
+      readIORef ref `shouldReturn` "YAY!"
diff --git a/test/Test/Hspec/Api/Formatters/V1Spec.hs b/test/Test/Hspec/Api/Formatters/V1Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/Hspec/Api/Formatters/V1Spec.hs
@@ -0,0 +1,20 @@
+module Test.Hspec.Api.Formatters.V1Spec (spec) where
+
+import           Test.Hspec
+import           Test.Hspec.Runner
+
+import           Data.IORef
+import           Control.Monad.IO.Class
+
+import           Test.Hspec.Api.Formatters.V1
+
+spec :: Spec
+spec = do
+  describe "useFormatter" $ do
+    it "sets a formatter to be used with a given config" $ do
+      ref <- newIORef "NAY!"
+      let
+        formatter :: Formatter
+        formatter = silent { exampleStarted = \ _ -> liftIO $ writeIORef ref "YAY!" }
+      hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) $ it "" True
+      readIORef ref `shouldReturn` "YAY!"
diff --git a/test/Test/Hspec/Api/Formatters/V2Spec.hs b/test/Test/Hspec/Api/Formatters/V2Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/Hspec/Api/Formatters/V2Spec.hs
@@ -0,0 +1,20 @@
+module Test.Hspec.Api.Formatters.V2Spec (spec) where
+
+import           Test.Hspec
+import           Test.Hspec.Runner
+
+import           Data.IORef
+import           Control.Monad.IO.Class
+
+import           Test.Hspec.Api.Formatters.V2
+
+spec :: Spec
+spec = do
+  describe "useFormatter" $ do
+    it "sets a formatter to be used with a given config" $ do
+      ref <- newIORef "NAY!"
+      let
+        formatter :: Formatter
+        formatter = silent { formatterItemStarted = \ _ -> liftIO $ writeIORef ref "YAY!" }
+      hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) $ it "" True
+      readIORef ref `shouldReturn` "YAY!"
