diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for openai-servant-gen
+
+## 0.1.0.0 -- 2024-03-15
+
+* First version. Released on an unsuspecting world.
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2024 Junji Hashimoto
+
+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.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/lib/OpenAI/API.hs b/lib/OpenAI/API.hs
new file mode 100644
--- /dev/null
+++ b/lib/OpenAI/API.hs
@@ -0,0 +1,539 @@
+{-# LANGUAGE DataKinds                  #-}
+{-# LANGUAGE DeriveDataTypeable         #-}
+{-# LANGUAGE DeriveGeneric              #-}
+{-# LANGUAGE DeriveTraversable          #-}
+{-# LANGUAGE DuplicateRecordFields      #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE FlexibleInstances          #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings          #-}
+{-# LANGUAGE OverloadedStrings          #-}
+{-# LANGUAGE RecordWildCards            #-}
+{-# LANGUAGE TypeFamilies               #-}
+{-# LANGUAGE TypeOperators              #-}
+{-# LANGUAGE ViewPatterns               #-}
+{-# LANGUAGE MultiParamTypeClasses      #-}
+
+{-# OPTIONS_GHC
+-fno-warn-unused-binds -fno-warn-unused-imports -freduction-depth=328 #-}
+
+module OpenAI.API
+  ( -- * Client and Server
+    Config(..)
+  , OpenAIBackend(..)
+  , createOpenAIClient
+  , runOpenAIServer
+  , runOpenAIMiddlewareServer
+  , runOpenAIClient
+  , runOpenAIClientWithManager
+  , callOpenAI
+  , OpenAIClient
+  , OpenAIClientError(..)
+  -- ** Servant
+  , OpenAIAPI
+  -- ** Plain WAI Application
+  , serverWaiApplicationOpenAI
+  -- ** Authentication
+  , OpenAIAuth(..)
+  , clientAuth
+  , Protected
+  ) where
+
+import           OpenAI.Types
+
+import           Control.Monad.Catch                (Exception, MonadThrow, throwM)
+import           Control.Monad.Except               (ExceptT, runExceptT)
+import           Control.Monad.IO.Class
+import           Control.Monad.Trans.Reader         (ReaderT (..))
+import           Data.Aeson                         (Value)
+import           Data.ByteString                    (ByteString, fromStrict, toStrict)
+import           Data.Coerce                        (coerce)
+import           Data.Data                          (Data)
+import           Data.Function                      ((&))
+import qualified Data.Map                           as Map
+import           Data.Monoid                        ((<>))
+import           Data.Proxy                         (Proxy (..))
+import           Data.Set                           (Set)
+import           Data.Text                          (Text)
+import qualified Data.Text                          as T
+import           Data.Time
+import           Data.UUID                          (UUID)
+import           GHC.Exts                           (IsString (..))
+import           GHC.Generics                       (Generic)
+import           Network.HTTP.Client                (Manager, newManager)
+import           Network.HTTP.Client.TLS            (tlsManagerSettings)
+import           Network.HTTP.Types.Method          (methodOptions)
+import           Network.Wai                        (Middleware, Request, requestHeaders)
+import qualified Network.Wai.Handler.Warp           as Warp
+import           Network.Wai.Middleware.HttpAuth    (extractBearerAuth)
+import           Servant                            (ServerError, serveWithContextT, throwError)
+import           Servant.API                        hiding (addHeader)
+import           Servant.API.Verbs                  (StdMethod (..), Verb)
+import           Servant.API.Experimental.Auth      (AuthProtect)
+import           Servant.Client                     (ClientEnv, Scheme (Http), ClientError, client,
+                                                     mkClientEnv, parseBaseUrl)
+import           Servant.Client.Core                (baseUrlPort, baseUrlHost, AuthClientData, AuthenticatedRequest, addHeader, mkAuthenticatedRequest)
+import           Servant.Client.Internal.HttpClient (ClientM (..))
+import           Servant.Server                     (Handler (..), Application, Context ((:.), EmptyContext))
+import           Servant.Server.Experimental.Auth   (AuthHandler, AuthServerData, mkAuthHandler)
+import           Servant.Server.StaticFiles         (serveDirectoryFileServer)
+import           Web.FormUrlEncoded
+import           Web.HttpApiData
+
+import qualified Network.HTTP.Media               as M
+import           Data.Data
+
+data FormCreateTranscription = FormCreateTranscription
+  { createTranscriptionFile :: FilePath
+  , createTranslationModel :: String
+  , createTranscriptionLanguage :: Text
+  , createTranscriptionPrompt :: Text
+  , createTranscriptionResponseFormat :: Text
+  , createTranscriptionTemperature :: Double
+  , createTranscriptionTimestampGranularities :: [Text]
+  } deriving (Show, Eq, Generic, Data)
+
+instance FromForm FormCreateTranscription
+instance ToForm FormCreateTranscription
+
+data FormCreateTranslation = FormCreateTranslation
+  { createTranslationFile :: FilePath
+  , createTranslationModel :: String
+  , createTranslationPrompt :: Text
+  , createTranslationResponseFormat :: Text
+  , createTranslationTemperature :: Double
+  } deriving (Show, Eq, Generic, Data)
+
+instance FromForm FormCreateTranslation
+instance ToForm FormCreateTranslation
+
+data FormCreateFile = FormCreateFile
+  { createFileFile :: FilePath
+  , createFilePurpose :: Text
+  } deriving (Show, Eq, Generic, Data)
+
+instance FromForm FormCreateFile
+instance ToForm FormCreateFile
+
+data FormCreateImageEdit = FormCreateImageEdit
+  { createImageEditImage :: FilePath
+  , createImageEditPrompt :: Text
+  , createImageEditMask :: FilePath
+--  , createImageVariationModel :: CreateImageEditRequestModel
+  , createImageEditN :: Int
+  , createImageEditSize :: Text
+  , createImageEditResponseFormat :: Text
+  , createImageEditUser :: Text
+  } deriving (Show, Eq, Generic, Data)
+
+instance FromForm FormCreateImageEdit
+instance ToForm FormCreateImageEdit
+
+data FormCreateImageVariation = FormCreateImageVariation
+  { createImageVariationImage :: FilePath
+--  , createImageVariationModel :: CreateImageEditRequestModel
+  , createImageVariationN :: Int
+  , createImageVariationResponseFormat :: Text
+  , createImageVariationSize :: Text
+  , createImageVariationUser :: Text
+  } deriving (Show, Eq, Generic, Data)
+
+instance FromForm FormCreateImageVariation
+instance ToForm FormCreateImageVariation
+
+
+-- | List of elements parsed from a query.
+newtype QueryList (p :: CollectionFormat) a = QueryList
+  { fromQueryList :: [a]
+  } deriving (Functor, Applicative, Monad, Foldable, Traversable)
+
+-- | Formats in which a list can be encoded into a HTTP path.
+data CollectionFormat
+  = CommaSeparated -- ^ CSV format for multiple parameters.
+  | SpaceSeparated -- ^ Also called "SSV"
+  | TabSeparated -- ^ Also called "TSV"
+  | PipeSeparated -- ^ `value1|value2|value2`
+  | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. Only for GET params.
+
+instance FromHttpApiData a => FromHttpApiData (QueryList 'CommaSeparated a) where
+  parseQueryParam = parseSeparatedQueryList ','
+
+instance FromHttpApiData a => FromHttpApiData (QueryList 'TabSeparated a) where
+  parseQueryParam = parseSeparatedQueryList '\t'
+
+instance FromHttpApiData a => FromHttpApiData (QueryList 'SpaceSeparated a) where
+  parseQueryParam = parseSeparatedQueryList ' '
+
+instance FromHttpApiData a => FromHttpApiData (QueryList 'PipeSeparated a) where
+  parseQueryParam = parseSeparatedQueryList '|'
+
+instance FromHttpApiData a => FromHttpApiData (QueryList 'MultiParamArray a) where
+  parseQueryParam = error "unimplemented FromHttpApiData for MultiParamArray collection format"
+
+parseSeparatedQueryList :: FromHttpApiData a => Char -> Text -> Either Text (QueryList p a)
+parseSeparatedQueryList char = fmap QueryList . mapM parseQueryParam . T.split (== char)
+
+instance ToHttpApiData a => ToHttpApiData (QueryList 'CommaSeparated a) where
+  toQueryParam = formatSeparatedQueryList ','
+
+instance ToHttpApiData a => ToHttpApiData (QueryList 'TabSeparated a) where
+  toQueryParam = formatSeparatedQueryList '\t'
+
+instance ToHttpApiData a => ToHttpApiData (QueryList 'SpaceSeparated a) where
+  toQueryParam = formatSeparatedQueryList ' '
+
+instance ToHttpApiData a => ToHttpApiData (QueryList 'PipeSeparated a) where
+  toQueryParam = formatSeparatedQueryList '|'
+
+instance ToHttpApiData a => ToHttpApiData (QueryList 'MultiParamArray a) where
+  toQueryParam = error "unimplemented ToHttpApiData for MultiParamArray collection format"
+
+formatSeparatedQueryList :: ToHttpApiData a => Char ->  QueryList p a -> Text
+formatSeparatedQueryList char = T.intercalate (T.singleton char) . map toQueryParam . fromQueryList
+
+data AudioMpeg deriving Typeable
+instance Accept AudioMpeg where
+    contentType _ = "audio" M.// "mpeg"
+
+instance MimeRender AudioMpeg ByteString where
+    mimeRender _ = fromStrict
+
+instance MimeUnrender AudioMpeg ByteString where
+    mimeUnrender _ = Right . toStrict
+
+-- | Servant type-level API, generated from the OpenAPI spec for OpenAI.
+type OpenAIAPI
+    =    Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> "cancel" :> Verb 'POST 200 '[JSON] RunObject -- 'cancelRun' route
+    :<|> Protected :> "assistants" :> ReqBody '[JSON] CreateAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject -- 'createAssistant' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> "files" :> ReqBody '[JSON] CreateAssistantFileRequest :> Verb 'POST 200 '[JSON] AssistantFileObject -- 'createAssistantFile' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> ReqBody '[JSON] CreateMessageRequest :> Verb 'POST 200 '[JSON] MessageObject -- 'createMessage' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> ReqBody '[JSON] CreateRunRequest :> Verb 'POST 200 '[JSON] RunObject -- 'createRun' route
+    :<|> Protected :> "threads" :> ReqBody '[JSON] CreateThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject -- 'createThread' route
+    :<|> Protected :> "threads" :> "runs" :> ReqBody '[JSON] CreateThreadAndRunRequest :> Verb 'POST 200 '[JSON] RunObject -- 'createThreadAndRun' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantResponse -- 'deleteAssistant' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> "files" :> Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteAssistantFileResponse -- 'deleteAssistantFile' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> Verb 'DELETE 200 '[JSON] DeleteThreadResponse -- 'deleteThread' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> Verb 'GET 200 '[JSON] AssistantObject -- 'getAssistant' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> "files" :> Capture "file_id" Text :> Verb 'GET 200 '[JSON] AssistantFileObject -- 'getAssistantFile' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> Capture "message_id" Text :> Verb 'GET 200 '[JSON] MessageObject -- 'getMessage' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> Capture "message_id" Text :> "files" :> Capture "file_id" Text :> Verb 'GET 200 '[JSON] MessageFileObject -- 'getMessageFile' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> Verb 'GET 200 '[JSON] RunObject -- 'getRun' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> "steps" :> Capture "step_id" Text :> Verb 'GET 200 '[JSON] RunStepObject -- 'getRunStep' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> Verb 'GET 200 '[JSON] ThreadObject -- 'getThread' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> "files" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantFilesResponse -- 'listAssistantFiles' route
+    :<|> Protected :> "assistants" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListAssistantsResponse -- 'listAssistants' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> Capture "message_id" Text :> "files" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessageFilesResponse -- 'listMessageFiles' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListMessagesResponse -- 'listMessages' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> "steps" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunStepsResponse -- 'listRunSteps' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> QueryParam "limit" Int :> QueryParam "order" Text :> QueryParam "after" Text :> QueryParam "before" Text :> Verb 'GET 200 '[JSON] ListRunsResponse -- 'listRuns' route
+    :<|> Protected :> "assistants" :> Capture "assistant_id" Text :> ReqBody '[JSON] ModifyAssistantRequest :> Verb 'POST 200 '[JSON] AssistantObject -- 'modifyAssistant' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "messages" :> Capture "message_id" Text :> ReqBody '[JSON] ModifyMessageRequest :> Verb 'POST 200 '[JSON] MessageObject -- 'modifyMessage' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> ReqBody '[JSON] ModifyRunRequest :> Verb 'POST 200 '[JSON] RunObject -- 'modifyRun' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> ReqBody '[JSON] ModifyThreadRequest :> Verb 'POST 200 '[JSON] ThreadObject -- 'modifyThread' route
+    :<|> Protected :> "threads" :> Capture "thread_id" Text :> "runs" :> Capture "run_id" Text :> "submit_tool_outputs" :> ReqBody '[JSON] SubmitToolOutputsRunRequest :> Verb 'POST 200 '[JSON] RunObject -- 'submitToolOuputsToRun' route
+    :<|> Protected :> "audio" :> "speech" :> ReqBody '[JSON] CreateSpeechRequest :> Verb 'POST 200 '[AudioMpeg] ByteString -- 'createSpeech' route
+    :<|> Protected :> "audio" :> "transcriptions" :> ReqBody '[FormUrlEncoded] FormCreateTranscription :> Verb 'POST 200 '[JSON] CreateTranscription200Response -- 'createTranscription' route
+    :<|> Protected :> "audio" :> "translations" :> ReqBody '[FormUrlEncoded] FormCreateTranslation :> Verb 'POST 200 '[JSON] CreateTranslation200Response -- 'createTranslation' route
+    :<|> Protected :> "chat" :> "completions" :> ReqBody '[JSON] CreateChatCompletionRequest :> Verb 'POST 200 '[JSON] CreateChatCompletionResponse -- 'createChatCompletion' route
+    :<|> Protected :> "completions" :> ReqBody '[JSON] CreateCompletionRequest :> Verb 'POST 200 '[JSON] CreateCompletionResponse -- 'createCompletion' route
+    :<|> Protected :> "embeddings" :> ReqBody '[JSON] CreateEmbeddingRequest :> Verb 'POST 200 '[JSON] CreateEmbeddingResponse -- 'createEmbedding' route
+    :<|> Protected :> "files" :> ReqBody '[FormUrlEncoded] FormCreateFile :> Verb 'POST 200 '[JSON] OpenAIFile -- 'createFile' route
+    :<|> Protected :> "files" :> Capture "file_id" Text :> Verb 'DELETE 200 '[JSON] DeleteFileResponse -- 'deleteFile' route
+    :<|> Protected :> "files" :> Capture "file_id" Text :> "content" :> Verb 'GET 200 '[JSON] Text -- 'downloadFile' route
+    :<|> Protected :> "files" :> QueryParam "purpose" Text :> Verb 'GET 200 '[JSON] ListFilesResponse -- 'listFiles' route
+    :<|> Protected :> "files" :> Capture "file_id" Text :> Verb 'GET 200 '[JSON] OpenAIFile -- 'retrieveFile' route
+    :<|> Protected :> "fine_tuning" :> "jobs" :> Capture "fine_tuning_job_id" Text :> "cancel" :> Verb 'POST 200 '[JSON] FineTuningJob -- 'cancelFineTuningJob' route
+    :<|> Protected :> "fine_tuning" :> "jobs" :> ReqBody '[JSON] CreateFineTuningJobRequest :> Verb 'POST 200 '[JSON] FineTuningJob -- 'createFineTuningJob' route
+    :<|> Protected :> "fine_tuning" :> "jobs" :> Capture "fine_tuning_job_id" Text :> "events" :> QueryParam "after" Text :> QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListFineTuningJobEventsResponse -- 'listFineTuningEvents' route
+    :<|> Protected :> "fine_tuning" :> "jobs" :> QueryParam "after" Text :> QueryParam "limit" Int :> Verb 'GET 200 '[JSON] ListPaginatedFineTuningJobsResponse -- 'listPaginatedFineTuningJobs' route
+    :<|> Protected :> "fine_tuning" :> "jobs" :> Capture "fine_tuning_job_id" Text :> Verb 'GET 200 '[JSON] FineTuningJob -- 'retrieveFineTuningJob' route
+    :<|> Protected :> "images" :> "generations" :> ReqBody '[JSON] CreateImageRequest :> Verb 'POST 200 '[JSON] ImagesResponse -- 'createImage' route
+    :<|> Protected :> "images" :> "edits" :> ReqBody '[FormUrlEncoded] FormCreateImageEdit :> Verb 'POST 200 '[JSON] ImagesResponse -- 'createImageEdit' route
+    :<|> Protected :> "images" :> "variations" :> ReqBody '[FormUrlEncoded] FormCreateImageVariation :> Verb 'POST 200 '[JSON] ImagesResponse -- 'createImageVariation' route
+    :<|> Protected :> "models" :> Capture "model" Text :> Verb 'DELETE 200 '[JSON] DeleteModelResponse -- 'deleteModel' route
+    :<|> Protected :> "models" :> Verb 'GET 200 '[JSON] ListModelsResponse -- 'listModels' route
+    :<|> Protected :> "models" :> Capture "model" Text :> Verb 'GET 200 '[JSON] Model -- 'retrieveModel' route
+    :<|> Protected :> "moderations" :> ReqBody '[JSON] CreateModerationRequest :> Verb 'POST 200 '[JSON] CreateModerationResponse -- 'createModeration' route
+    :<|> Raw
+
+
+-- | Server or client configuration, specifying the host and port to query or serve on.
+data Config = Config
+  { configUrl :: String  -- ^ scheme://hostname:port/path, e.g. "http://localhost:8080/"
+  } deriving (Eq, Ord, Show, Read)
+
+
+-- | Custom exception type for our errors.
+newtype OpenAIClientError = OpenAIClientError ClientError
+  deriving (Show, Exception)
+-- | Configuration, specifying the full url of the service.
+
+
+-- | Backend for OpenAI.
+-- The backend can be used both for the client and the server. The client generated from the OpenAI OpenAPI spec
+-- is a backend that executes actions by sending HTTP requests (see @createOpenAIClient@). Alternatively, provided
+-- a backend, the API can be served using @runOpenAIMiddlewareServer@.
+data OpenAIBackend a m = OpenAIBackend
+  { cancelRun :: a -> Text -> Text -> m RunObject{- ^  -}
+  , createAssistant :: a -> CreateAssistantRequest -> m AssistantObject{- ^  -}
+  , createAssistantFile :: a -> Text -> CreateAssistantFileRequest -> m AssistantFileObject{- ^  -}
+  , createMessage :: a -> Text -> CreateMessageRequest -> m MessageObject{- ^  -}
+  , createRun :: a -> Text -> CreateRunRequest -> m RunObject{- ^  -}
+  , createThread :: a -> CreateThreadRequest -> m ThreadObject{- ^  -}
+  , createThreadAndRun :: a -> CreateThreadAndRunRequest -> m RunObject{- ^  -}
+  , deleteAssistant :: a -> Text -> m DeleteAssistantResponse{- ^  -}
+  , deleteAssistantFile :: a -> Text -> Text -> m DeleteAssistantFileResponse{- ^  -}
+  , deleteThread :: a -> Text -> m DeleteThreadResponse{- ^  -}
+  , getAssistant :: a -> Text -> m AssistantObject{- ^  -}
+  , getAssistantFile :: a -> Text -> Text -> m AssistantFileObject{- ^  -}
+  , getMessage :: a -> Text -> Text -> m MessageObject{- ^  -}
+  , getMessageFile :: a -> Text -> Text -> Text -> m MessageFileObject{- ^  -}
+  , getRun :: a -> Text -> Text -> m RunObject{- ^  -}
+  , getRunStep :: a -> Text -> Text -> Text -> m RunStepObject{- ^  -}
+  , getThread :: a -> Text -> m ThreadObject{- ^  -}
+  , listAssistantFiles :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListAssistantFilesResponse{- ^  -}
+  , listAssistants :: a -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListAssistantsResponse{- ^  -}
+  , listMessageFiles :: a -> Text -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListMessageFilesResponse{- ^  -}
+  , listMessages :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListMessagesResponse{- ^  -}
+  , listRunSteps :: a -> Text -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListRunStepsResponse{- ^  -}
+  , listRuns :: a -> Text -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> m ListRunsResponse{- ^  -}
+  , modifyAssistant :: a -> Text -> ModifyAssistantRequest -> m AssistantObject{- ^  -}
+  , modifyMessage :: a -> Text -> Text -> ModifyMessageRequest -> m MessageObject{- ^  -}
+  , modifyRun :: a -> Text -> Text -> ModifyRunRequest -> m RunObject{- ^  -}
+  , modifyThread :: a -> Text -> ModifyThreadRequest -> m ThreadObject{- ^  -}
+  , submitToolOuputsToRun :: a -> Text -> Text -> SubmitToolOutputsRunRequest -> m RunObject{- ^  -}
+  , createSpeech :: a -> CreateSpeechRequest -> m ByteString{- ^  -}
+  , createTranscription :: a -> FormCreateTranscription -> m CreateTranscription200Response{- ^  -}
+  , createTranslation :: a -> FormCreateTranslation -> m CreateTranslation200Response{- ^  -}
+  , createChatCompletion :: a -> CreateChatCompletionRequest -> m CreateChatCompletionResponse{- ^  -}
+  , createCompletion :: a -> CreateCompletionRequest -> m CreateCompletionResponse{- ^  -}
+  , createEmbedding :: a -> CreateEmbeddingRequest -> m CreateEmbeddingResponse{- ^  -}
+  , createFile :: a -> FormCreateFile -> m OpenAIFile{- ^  -}
+  , deleteFile :: a -> Text -> m DeleteFileResponse{- ^  -}
+  , downloadFile :: a -> Text -> m Text{- ^  -}
+  , listFiles :: a -> Maybe Text -> m ListFilesResponse{- ^  -}
+  , retrieveFile :: a -> Text -> m OpenAIFile{- ^  -}
+  , cancelFineTuningJob :: a -> Text -> m FineTuningJob{- ^  -}
+  , createFineTuningJob :: a -> CreateFineTuningJobRequest -> m FineTuningJob{- ^  -}
+  , listFineTuningEvents :: a -> Text -> Maybe Text -> Maybe Int -> m ListFineTuningJobEventsResponse{- ^  -}
+  , listPaginatedFineTuningJobs :: a -> Maybe Text -> Maybe Int -> m ListPaginatedFineTuningJobsResponse{- ^  -}
+  , retrieveFineTuningJob :: a -> Text -> m FineTuningJob{- ^  -}
+  , createImage :: a -> CreateImageRequest -> m ImagesResponse{- ^  -}
+  , createImageEdit :: a -> FormCreateImageEdit -> m ImagesResponse{- ^  -}
+  , createImageVariation :: a -> FormCreateImageVariation -> m ImagesResponse{- ^  -}
+  , deleteModel :: a -> Text -> m DeleteModelResponse{- ^  -}
+  , listModels :: a -> m ListModelsResponse{- ^  -}
+  , retrieveModel :: a -> Text -> m Model{- ^  -}
+  , createModeration :: a -> CreateModerationRequest -> m CreateModerationResponse{- ^  -}
+  }
+
+-- | Authentication settings for OpenAI.
+-- lookupUser is used to retrieve a user given a header value. The data type can be specified by providing an
+-- type instance for AuthServerData. authError is a function that given a request returns a custom error that
+-- is returned when the header is not found.
+data OpenAIAuth = OpenAIAuth
+  { lookupUser :: ByteString -> Handler AuthServer
+  , authError :: Request -> ServerError
+  }
+
+newtype OpenAIClient a = OpenAIClient
+  { runClient :: ClientEnv -> ExceptT ClientError IO a
+  } deriving Functor
+
+instance Applicative OpenAIClient where
+  pure x = OpenAIClient (\_ -> pure x)
+  (OpenAIClient f) <*> (OpenAIClient x) =
+    OpenAIClient (\env -> f env <*> x env)
+
+instance Monad OpenAIClient where
+  (OpenAIClient a) >>= f =
+    OpenAIClient (\env -> do
+      value <- a env
+      runClient (f value) env)
+
+instance MonadIO OpenAIClient where
+  liftIO io = OpenAIClient (\_ -> liftIO io)
+
+createOpenAIClient :: OpenAIBackend AuthClient OpenAIClient
+createOpenAIClient = OpenAIBackend{..}
+  where
+    ((coerce -> cancelRun) :<|>
+     (coerce -> createAssistant) :<|>
+     (coerce -> createAssistantFile) :<|>
+     (coerce -> createMessage) :<|>
+     (coerce -> createRun) :<|>
+     (coerce -> createThread) :<|>
+     (coerce -> createThreadAndRun) :<|>
+     (coerce -> deleteAssistant) :<|>
+     (coerce -> deleteAssistantFile) :<|>
+     (coerce -> deleteThread) :<|>
+     (coerce -> getAssistant) :<|>
+     (coerce -> getAssistantFile) :<|>
+     (coerce -> getMessage) :<|>
+     (coerce -> getMessageFile) :<|>
+     (coerce -> getRun) :<|>
+     (coerce -> getRunStep) :<|>
+     (coerce -> getThread) :<|>
+     (coerce -> listAssistantFiles) :<|>
+     (coerce -> listAssistants) :<|>
+     (coerce -> listMessageFiles) :<|>
+     (coerce -> listMessages) :<|>
+     (coerce -> listRunSteps) :<|>
+     (coerce -> listRuns) :<|>
+     (coerce -> modifyAssistant) :<|>
+     (coerce -> modifyMessage) :<|>
+     (coerce -> modifyRun) :<|>
+     (coerce -> modifyThread) :<|>
+     (coerce -> submitToolOuputsToRun) :<|>
+     (coerce -> createSpeech) :<|>
+     (coerce -> createTranscription) :<|>
+     (coerce -> createTranslation) :<|>
+     (coerce -> createChatCompletion) :<|>
+     (coerce -> createCompletion) :<|>
+     (coerce -> createEmbedding) :<|>
+     (coerce -> createFile) :<|>
+     (coerce -> deleteFile) :<|>
+     (coerce -> downloadFile) :<|>
+     (coerce -> listFiles) :<|>
+     (coerce -> retrieveFile) :<|>
+     (coerce -> cancelFineTuningJob) :<|>
+     (coerce -> createFineTuningJob) :<|>
+     (coerce -> listFineTuningEvents) :<|>
+     (coerce -> listPaginatedFineTuningJobs) :<|>
+     (coerce -> retrieveFineTuningJob) :<|>
+     (coerce -> createImage) :<|>
+     (coerce -> createImageEdit) :<|>
+     (coerce -> createImageVariation) :<|>
+     (coerce -> deleteModel) :<|>
+     (coerce -> listModels) :<|>
+     (coerce -> retrieveModel) :<|>
+     (coerce -> createModeration) :<|>
+     _) = client (Proxy :: Proxy OpenAIAPI)
+
+-- | Run requests in the OpenAIClient monad.
+runOpenAIClient :: Config -> OpenAIClient a -> ExceptT ClientError IO a
+runOpenAIClient clientConfig cl = do
+  manager <- liftIO $ newManager tlsManagerSettings
+  runOpenAIClientWithManager manager clientConfig cl
+
+-- | Run requests in the OpenAIClient monad using a custom manager.
+runOpenAIClientWithManager :: Manager -> Config -> OpenAIClient a -> ExceptT ClientError IO a
+runOpenAIClientWithManager manager Config{..} cl = do
+  url <- parseBaseUrl configUrl
+  runClient cl $ mkClientEnv manager url
+
+-- | Like @runClient@, but returns the response or throws
+--   a OpenAIClientError
+callOpenAI
+  :: (MonadIO m, MonadThrow m)
+  => ClientEnv -> OpenAIClient a -> m a
+callOpenAI env f = do
+  res <- liftIO $ runExceptT $ runClient f env
+  case res of
+    Left err       -> throwM (OpenAIClientError err)
+    Right response -> pure response
+
+
+requestMiddlewareId :: Application -> Application
+requestMiddlewareId a = a
+
+-- | Run the OpenAI server at the provided host and port.
+runOpenAIServer
+  :: (MonadIO m, MonadThrow m)
+  => Config -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m ()
+runOpenAIServer config auth backend = runOpenAIMiddlewareServer config requestMiddlewareId auth backend
+
+-- | Run the OpenAI server at the provided host and port.
+runOpenAIMiddlewareServer
+  :: (MonadIO m, MonadThrow m)
+  => Config -> Middleware -> OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> m ()
+runOpenAIMiddlewareServer Config{..} middleware auth backend = do
+  url <- parseBaseUrl configUrl
+  let warpSettings = Warp.defaultSettings
+        & Warp.setPort (baseUrlPort url)
+        & Warp.setHost (fromString $ baseUrlHost url)
+  liftIO $ Warp.runSettings warpSettings $ middleware $ serverWaiApplicationOpenAI auth backend
+
+-- | Plain "Network.Wai" Application for the OpenAI server.
+--
+-- Can be used to implement e.g. tests that call the API without a full webserver.
+serverWaiApplicationOpenAI :: OpenAIAuth -> OpenAIBackend AuthServer (ExceptT ServerError IO) -> Application
+serverWaiApplicationOpenAI auth backend = serveWithContextT (Proxy :: Proxy OpenAIAPI) context id (serverFromBackend backend)
+  where
+    context = serverContext auth
+    serverFromBackend OpenAIBackend{..} =
+      (coerce cancelRun :<|>
+       coerce createAssistant :<|>
+       coerce createAssistantFile :<|>
+       coerce createMessage :<|>
+       coerce createRun :<|>
+       coerce createThread :<|>
+       coerce createThreadAndRun :<|>
+       coerce deleteAssistant :<|>
+       coerce deleteAssistantFile :<|>
+       coerce deleteThread :<|>
+       coerce getAssistant :<|>
+       coerce getAssistantFile :<|>
+       coerce getMessage :<|>
+       coerce getMessageFile :<|>
+       coerce getRun :<|>
+       coerce getRunStep :<|>
+       coerce getThread :<|>
+       coerce listAssistantFiles :<|>
+       coerce listAssistants :<|>
+       coerce listMessageFiles :<|>
+       coerce listMessages :<|>
+       coerce listRunSteps :<|>
+       coerce listRuns :<|>
+       coerce modifyAssistant :<|>
+       coerce modifyMessage :<|>
+       coerce modifyRun :<|>
+       coerce modifyThread :<|>
+       coerce submitToolOuputsToRun :<|>
+       coerce createSpeech :<|>
+       coerce createTranscription :<|>
+       coerce createTranslation :<|>
+       coerce createChatCompletion :<|>
+       coerce createCompletion :<|>
+       coerce createEmbedding :<|>
+       coerce createFile :<|>
+       coerce deleteFile :<|>
+       coerce downloadFile :<|>
+       coerce listFiles :<|>
+       coerce retrieveFile :<|>
+       coerce cancelFineTuningJob :<|>
+       coerce createFineTuningJob :<|>
+       coerce listFineTuningEvents :<|>
+       coerce listPaginatedFineTuningJobs :<|>
+       coerce retrieveFineTuningJob :<|>
+       coerce createImage :<|>
+       coerce createImageEdit :<|>
+       coerce createImageVariation :<|>
+       coerce deleteModel :<|>
+       coerce listModels :<|>
+       coerce retrieveModel :<|>
+       coerce createModeration :<|>
+       serveDirectoryFileServer "static")
+
+-- Authentication is implemented with servants generalized authentication:
+-- https://docs.servant.dev/en/stable/tutorial/Authentication.html#generalized-authentication
+
+authHandler :: OpenAIAuth -> AuthHandler Request AuthServer
+authHandler OpenAIAuth{..} = mkAuthHandler handler
+  where
+    handler req = case lookup "Authorization" (requestHeaders req) of
+      Just header -> case extractBearerAuth header of
+        Just key -> lookupUser key
+        Nothing -> throwError (authError req)
+      Nothing -> throwError (authError req)
+
+type Protected = AuthProtect "bearer"
+type AuthServer = AuthServerData Protected
+type AuthClient = AuthenticatedRequest Protected
+type instance AuthClientData Protected = Text
+
+clientAuth :: Text -> AuthClient
+clientAuth key = mkAuthenticatedRequest ("Bearer " <> key) (addHeader "Authorization")
+
+serverContext :: OpenAIAuth -> Context (AuthHandler Request AuthServer ': '[])
+serverContext auth = authHandler auth :. EmptyContext
diff --git a/lib/OpenAI/Types.hs b/lib/OpenAI/Types.hs
new file mode 100644
--- /dev/null
+++ b/lib/OpenAI/Types.hs
@@ -0,0 +1,2489 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE DeriveDataTypeable         #-}
+{-# LANGUAGE DeriveGeneric              #-}
+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-}
+{-# LANGUAGE InstanceSigs #-}
+{-# LANGUAGE LambdaCase #-}
+
+module OpenAI.Types (
+  AssistantFileObject (..),
+  AssistantObject (..),
+  AssistantObjectToolsInner (..),
+  AssistantToolsCode (..),
+  AssistantToolsFunction (..),
+  AssistantToolsRetrieval (..),
+  ChatCompletionFunctionCallOption (..),
+  ChatCompletionFunctions (..),
+  ChatCompletionMessageToolCall (..),
+  ChatCompletionMessageToolCallChunk (..),
+  ChatCompletionMessageToolCallChunkFunction (..),
+  ChatCompletionMessageToolCallFunction (..),
+  ChatCompletionNamedToolChoice (..),
+  ChatCompletionNamedToolChoiceFunction (..),
+  ChatCompletionRequestAssistantMessage (..),
+  ChatCompletionRequestAssistantMessageFunctionCall (..),
+  ChatCompletionRequestFunctionMessage (..),
+  ChatCompletionRequestMessage (..),
+  ChatCompletionRequestMessageContent (..),
+  ChatCompletionRequestMessageContentPart (..),
+  ChatCompletionRequestMessageContentPartImage (..),
+  ChatCompletionRequestMessageContentPartImageImageUrl (..),
+  ChatCompletionRequestMessageContentPartText (..),
+  ChatCompletionRequestSystemMessage (..),
+  ChatCompletionRequestToolMessage (..),
+  ChatCompletionRequestUserMessage (..),
+  ChatCompletionRequestUserMessageContent (..),
+  ChatCompletionResponseMessage (..),
+  ChatCompletionRole (..),
+  ChatCompletionStreamResponseDelta (..),
+  ChatCompletionStreamResponseDeltaFunctionCall (..),
+  ChatCompletionTokenLogprob (..),
+  ChatCompletionTokenLogprobTopLogprobsInner (..),
+  ChatCompletionTool (..),
+  ChatCompletionToolChoiceOption (..),
+  CompletionUsage (..),
+  CreateAssistantFileRequest (..),
+  CreateAssistantRequest (..),
+  CreateAssistantRequestModel (..),
+  CreateChatCompletionFunctionResponse (..),
+  CreateChatCompletionFunctionResponseChoicesInner (..),
+  CreateChatCompletionRequest (..),
+  CreateChatCompletionRequestFunctionCall (..),
+  CreateChatCompletionRequestModel (..),
+  CreateChatCompletionRequestResponseFormat (..),
+  CreateChatCompletionRequestStop (..),
+  CreateChatCompletionResponse (..),
+  CreateChatCompletionResponseChoicesInner (..),
+  CreateChatCompletionResponseChoicesInnerLogprobs (..),
+  CreateChatCompletionStreamResponse (..),
+  CreateChatCompletionStreamResponseChoicesInner (..),
+  CreateCompletionRequest (..),
+  CreateCompletionRequestModel (..),
+  CreateCompletionRequestPrompt (..),
+  CreateCompletionRequestStop (..),
+  CreateCompletionResponse (..),
+  CreateCompletionResponseChoicesInner (..),
+  CreateCompletionResponseChoicesInnerLogprobs (..),
+  CreateEmbeddingRequest (..),
+  CreateEmbeddingRequestInput (..),
+  CreateEmbeddingRequestModel (..),
+  CreateEmbeddingResponse (..),
+  CreateEmbeddingResponseUsage (..),
+  CreateFineTuningJobRequest (..),
+  CreateFineTuningJobRequestHyperparameters (..),
+  CreateFineTuningJobRequestHyperparametersBatchSize (..),
+  CreateFineTuningJobRequestHyperparametersLearningRateMultiplier (..),
+  CreateFineTuningJobRequestHyperparametersNEpochs (..),
+  CreateFineTuningJobRequestModel (..),
+  CreateImageRequest (..),
+  CreateImageRequestModel (..),
+  CreateMessageRequest (..),
+  CreateModerationRequest (..),
+  CreateModerationRequestInput (..),
+  CreateModerationRequestModel (..),
+  CreateModerationResponse (..),
+  CreateModerationResponseResultsInner (..),
+  CreateModerationResponseResultsInnerCategories (..),
+  CreateModerationResponseResultsInnerCategoryScores (..),
+  CreateRunRequest (..),
+  CreateSpeechRequest (..),
+  CreateSpeechRequestModel (..),
+  CreateThreadAndRunRequest (..),
+  CreateThreadAndRunRequestToolsInner (..),
+  CreateThreadRequest (..),
+  CreateTranscription200Response (..),
+  CreateTranscriptionResponseJson (..),
+  CreateTranscriptionResponseVerboseJson (..),
+  CreateTranslation200Response (..),
+  CreateTranslationResponseJson (..),
+  CreateTranslationResponseVerboseJson (..),
+  DeleteAssistantFileResponse (..),
+  DeleteAssistantResponse (..),
+  DeleteFileResponse (..),
+  DeleteMessageResponse (..),
+  DeleteModelResponse (..),
+  DeleteThreadResponse (..),
+  Embedding (..),
+  Error (..),
+  ErrorResponse (..),
+  FineTuningJob (..),
+  FineTuningJobError (..),
+  FineTuningJobEvent (..),
+  FineTuningJobHyperparameters (..),
+  FineTuningJobHyperparametersNEpochs (..),
+  FunctionObject (..),
+  Image (..),
+  ImagesResponse (..),
+  ListAssistantFilesResponse (..),
+  ListAssistantsResponse (..),
+  ListFilesResponse (..),
+  ListFineTuningJobEventsResponse (..),
+  ListMessageFilesResponse (..),
+  ListMessagesResponse (..),
+  ListModelsResponse (..),
+  ListPaginatedFineTuningJobsResponse (..),
+  ListRunStepsResponse (..),
+  ListRunsResponse (..),
+  ListThreadsResponse (..),
+  MessageContentImageFileObject (..),
+  MessageContentImageFileObjectImageFile (..),
+  MessageContentTextAnnotationsFileCitationObject (..),
+  MessageContentTextAnnotationsFileCitationObjectFileCitation (..),
+  MessageContentTextAnnotationsFilePathObject (..),
+  MessageContentTextAnnotationsFilePathObjectFilePath (..),
+  MessageContentTextObject (..),
+  MessageContentTextObjectText (..),
+  MessageContentTextObjectTextAnnotationsInner (..),
+  MessageFileObject (..),
+  MessageObject (..),
+  MessageObjectContentInner (..),
+  Model (..),
+  ModifyAssistantRequest (..),
+  ModifyMessageRequest (..),
+  ModifyRunRequest (..),
+  ModifyThreadRequest (..),
+  OpenAIFile (..),
+  RunCompletionUsage (..),
+  RunObject (..),
+  RunObjectLastError (..),
+  RunObjectRequiredAction (..),
+  RunObjectRequiredActionSubmitToolOutputs (..),
+  RunStepCompletionUsage (..),
+  RunStepDetailsMessageCreationObject (..),
+  RunStepDetailsMessageCreationObjectMessageCreation (..),
+  RunStepDetailsToolCallsCodeObject (..),
+  RunStepDetailsToolCallsCodeObjectCodeInterpreter (..),
+  RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner (..),
+  RunStepDetailsToolCallsCodeOutputImageObject (..),
+  RunStepDetailsToolCallsCodeOutputImageObjectImage (..),
+  RunStepDetailsToolCallsCodeOutputLogsObject (..),
+  RunStepDetailsToolCallsFunctionObject (..),
+  RunStepDetailsToolCallsFunctionObjectFunction (..),
+  RunStepDetailsToolCallsObject (..),
+  RunStepDetailsToolCallsObjectToolCallsInner (..),
+  RunStepDetailsToolCallsRetrievalObject (..),
+  RunStepObject (..),
+  RunStepObjectLastError (..),
+  RunStepObjectStepDetails (..),
+  RunToolCallObject (..),
+  RunToolCallObjectFunction (..),
+  SubmitToolOutputsRunRequest (..),
+  SubmitToolOutputsRunRequestToolOutputsInner (..),
+  ThreadObject (..),
+  TranscriptionSegment (..),
+  TranscriptionWord (..),
+  ) where
+
+import Data.Data (Data)
+import Data.UUID (UUID)
+import Data.List (stripPrefix)
+import Data.Maybe (fromMaybe)
+import Data.Aeson (Value, FromJSON(..), ToJSON(..), genericToJSON, genericParseJSON)
+import Data.Aeson.Types (Options(..), defaultOptions)
+import qualified Data.Aeson as Aeson
+import Data.Set (Set)
+import Data.Text (Text)
+import qualified Data.Vector as V
+import Data.Time
+import Data.Swagger (ToSchema, declareNamedSchema)
+import qualified Data.Swagger as Swagger
+import qualified Data.Char as Char
+import qualified Data.Text as T
+import qualified Data.Map as Map
+import GHC.Generics (Generic)
+import Data.Function ((&))
+
+
+-- | A list of [Files](/docs/api-reference/files) attached to an &#x60;assistant&#x60;.
+data AssistantFileObject = AssistantFileObject
+  { assistantFileObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , assistantFileObjectObject :: Text -- ^ The object type, which is always `assistant.file`.
+  , assistantFileObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the assistant file was created.
+  , assistantFileObjectAssistantUnderscoreid :: Text -- ^ The assistant ID that the file is attached to.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantFileObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantFileObject")
+instance ToJSON AssistantFileObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantFileObject")
+
+
+-- | Represents an &#x60;assistant&#x60; that can call the model and use tools.
+data AssistantObject = AssistantObject
+  { assistantObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , assistantObjectObject :: Text -- ^ The object type, which is always `assistant`.
+  , assistantObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the assistant was created.
+  , assistantObjectName :: Text -- ^ The name of the assistant. The maximum length is 256 characters. 
+  , assistantObjectDescription :: Text -- ^ The description of the assistant. The maximum length is 512 characters. 
+  , assistantObjectModel :: Text -- ^ ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. 
+  , assistantObjectInstructions :: Text -- ^ The system instructions that the assistant uses. The maximum length is 32768 characters. 
+  , assistantObjectTools :: [AssistantObjectToolsInner] -- ^ A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. 
+  , assistantObjectFileUnderscoreids :: [Text] -- ^ A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. 
+  , assistantObjectMetadata :: Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantObject")
+instance ToJSON AssistantObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantObject")
+
+
+-- | 
+data AssistantObjectToolsInner = AssistantObjectToolsInner
+  { assistantObjectToolsInnerType :: Text -- ^ The type of tool being defined: `function`
+  , assistantObjectToolsInnerFunction :: FunctionObject -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantObjectToolsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantObjectToolsInner")
+instance ToJSON AssistantObjectToolsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantObjectToolsInner")
+
+
+-- | 
+data AssistantToolsCode = AssistantToolsCode
+  { assistantToolsCodeType :: Text -- ^ The type of tool being defined: `code_interpreter`
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantToolsCode where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantToolsCode")
+instance ToJSON AssistantToolsCode where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantToolsCode")
+
+
+-- | 
+data AssistantToolsFunction = AssistantToolsFunction
+  { assistantToolsFunctionType :: Text -- ^ The type of tool being defined: `function`
+  , assistantToolsFunctionFunction :: FunctionObject -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantToolsFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantToolsFunction")
+instance ToJSON AssistantToolsFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantToolsFunction")
+
+
+-- | 
+data AssistantToolsRetrieval = AssistantToolsRetrieval
+  { assistantToolsRetrievalType :: Text -- ^ The type of tool being defined: `retrieval`
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON AssistantToolsRetrieval where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "assistantToolsRetrieval")
+instance ToJSON AssistantToolsRetrieval where
+  toJSON = genericToJSON (removeFieldLabelPrefix "assistantToolsRetrieval")
+
+
+-- | Specifying a particular function via &#x60;{\&quot;name\&quot;: \&quot;my_function\&quot;}&#x60; forces the model to call that function. 
+data ChatCompletionFunctionCallOption = ChatCompletionFunctionCallOption
+  { chatCompletionFunctionCallOptionName :: Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionFunctionCallOption where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionFunctionCallOption")
+instance ToJSON ChatCompletionFunctionCallOption where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionFunctionCallOption")
+
+
+-- | 
+data ChatCompletionFunctions = ChatCompletionFunctions
+  { chatCompletionFunctionsDescription :: Maybe Text -- ^ A description of what the function does, used by the model to choose when and how to call the function.
+  , chatCompletionFunctionsName :: Text -- ^ The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
+  , chatCompletionFunctionsParameters :: Maybe (Map.Map String Value) -- ^ The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.   Omitting `parameters` defines a function with an empty parameter list.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionFunctions where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionFunctions")
+instance ToJSON ChatCompletionFunctions where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionFunctions")
+
+
+-- | 
+data ChatCompletionMessageToolCall = ChatCompletionMessageToolCall
+  { chatCompletionMessageToolCallId :: Text -- ^ The ID of the tool call.
+  , chatCompletionMessageToolCallType :: Text -- ^ The type of the tool. Currently, only `function` is supported.
+  , chatCompletionMessageToolCallFunction :: ChatCompletionMessageToolCallFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionMessageToolCall where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionMessageToolCall")
+instance ToJSON ChatCompletionMessageToolCall where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionMessageToolCall")
+
+
+-- | 
+data ChatCompletionMessageToolCallChunk = ChatCompletionMessageToolCallChunk
+  { chatCompletionMessageToolCallChunkIndex :: Int -- ^ 
+  , chatCompletionMessageToolCallChunkId :: Maybe Text -- ^ The ID of the tool call.
+  , chatCompletionMessageToolCallChunkType :: Maybe Text -- ^ The type of the tool. Currently, only `function` is supported.
+  , chatCompletionMessageToolCallChunkFunction :: Maybe ChatCompletionMessageToolCallChunkFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionMessageToolCallChunk where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallChunk")
+instance ToJSON ChatCompletionMessageToolCallChunk where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallChunk")
+
+
+-- | 
+data ChatCompletionMessageToolCallChunkFunction = ChatCompletionMessageToolCallChunkFunction
+  { chatCompletionMessageToolCallChunkFunctionName :: Maybe Text -- ^ The name of the function to call.
+  , chatCompletionMessageToolCallChunkFunctionArguments :: Maybe Text -- ^ The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionMessageToolCallChunkFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallChunkFunction")
+instance ToJSON ChatCompletionMessageToolCallChunkFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallChunkFunction")
+
+
+-- | The function that the model called.
+data ChatCompletionMessageToolCallFunction = ChatCompletionMessageToolCallFunction
+  { chatCompletionMessageToolCallFunctionName :: Text -- ^ The name of the function to call.
+  , chatCompletionMessageToolCallFunctionArguments :: Text -- ^ The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionMessageToolCallFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallFunction")
+instance ToJSON ChatCompletionMessageToolCallFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionMessageToolCallFunction")
+
+
+-- | Specifies a tool the model should use. Use to force the model to call a specific function.
+data ChatCompletionNamedToolChoice = ChatCompletionNamedToolChoice
+  { chatCompletionNamedToolChoiceType :: Text -- ^ The type of the tool. Currently, only `function` is supported.
+  , chatCompletionNamedToolChoiceFunction :: ChatCompletionNamedToolChoiceFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionNamedToolChoice where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionNamedToolChoice")
+instance ToJSON ChatCompletionNamedToolChoice where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionNamedToolChoice")
+
+
+-- | 
+data ChatCompletionNamedToolChoiceFunction = ChatCompletionNamedToolChoiceFunction
+  { chatCompletionNamedToolChoiceFunctionName :: Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionNamedToolChoiceFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionNamedToolChoiceFunction")
+instance ToJSON ChatCompletionNamedToolChoiceFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionNamedToolChoiceFunction")
+
+
+-- | 
+data ChatCompletionRequestAssistantMessage = ChatCompletionRequestAssistantMessage
+  { chatCompletionRequestAssistantMessageContent :: Maybe Text -- ^ The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. 
+  , chatCompletionRequestAssistantMessageRole :: Text -- ^ The role of the messages author, in this case `assistant`.
+  , chatCompletionRequestAssistantMessageName :: Maybe Text -- ^ An optional name for the participant. Provides the model information to differentiate between participants of the same role.
+  , chatCompletionRequestAssistantMessageToolUnderscorecalls :: Maybe [ChatCompletionMessageToolCall] -- ^ The tool calls generated by the model, such as function calls.
+  , chatCompletionRequestAssistantMessageFunctionUnderscorecall :: Maybe ChatCompletionRequestAssistantMessageFunctionCall -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestAssistantMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestAssistantMessage")
+instance ToJSON ChatCompletionRequestAssistantMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestAssistantMessage")
+
+
+-- | Deprecated and replaced by &#x60;tool_calls&#x60;. The name and arguments of a function that should be called, as generated by the model.
+data ChatCompletionRequestAssistantMessageFunctionCall = ChatCompletionRequestAssistantMessageFunctionCall
+  { chatCompletionRequestAssistantMessageFunctionCallArguments :: Text -- ^ The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
+  , chatCompletionRequestAssistantMessageFunctionCallName :: Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestAssistantMessageFunctionCall where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestAssistantMessageFunctionCall")
+instance ToJSON ChatCompletionRequestAssistantMessageFunctionCall where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestAssistantMessageFunctionCall")
+
+
+-- | 
+data ChatCompletionRequestFunctionMessage = ChatCompletionRequestFunctionMessage
+  { chatCompletionRequestFunctionMessageRole :: Text -- ^ The role of the messages author, in this case `function`.
+  , chatCompletionRequestFunctionMessageContent :: Text -- ^ The contents of the function message.
+  , chatCompletionRequestFunctionMessageName :: Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestFunctionMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestFunctionMessage")
+instance ToJSON ChatCompletionRequestFunctionMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestFunctionMessage")
+
+
+-- | 
+data ChatCompletionRequestMessage = ChatCompletionRequestMessage
+  { chatCompletionRequestMessageContent :: Maybe ChatCompletionRequestMessageContent -- ^ The contents of the function message.
+  , chatCompletionRequestMessageRole :: Text -- ^ The role of the messages author, in this case `function`.
+  , chatCompletionRequestMessageName :: Maybe Text -- ^ The name of the function to call.
+  , chatCompletionRequestMessageToolUnderscorecalls :: Maybe [ChatCompletionMessageToolCall] -- ^ The tool calls generated by the model, such as function calls.
+  , chatCompletionRequestMessageFunctionUnderscorecall :: Maybe ChatCompletionRequestAssistantMessageFunctionCall -- ^ 
+  , chatCompletionRequestMessageToolUnderscorecallUnderscoreid :: Maybe Text -- ^ Tool call that this message is responding to.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestMessage")
+instance ToJSON ChatCompletionRequestMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestMessage")
+
+data ChatCompletionRequestMessageContent
+  = ChatCompletionRequestMessageContentText Text
+  | ChatCompletionRequestMessageContentParts [ChatCompletionRequestMessageContentPart]
+ deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessageContent where
+  -- When it is a string, parse it as a text
+  -- When it is a list, parse it as a list of parts
+  parseJSON = \case
+    Aeson.String text -> pure $ ChatCompletionRequestMessageContentText text
+    Aeson.Array parts -> do
+      parsedParts <- mapM Aeson.parseJSON $ V.toList parts
+      pure $ ChatCompletionRequestMessageContentParts parsedParts
+    _ -> fail "Invalid ChatCompletionRequestMessageContent"
+instance ToJSON ChatCompletionRequestMessageContent where
+  toJSON = \case
+    ChatCompletionRequestMessageContentText text -> Aeson.String text
+    ChatCompletionRequestMessageContentParts parts -> Aeson.Array $ V.fromList $ map toJSON parts
+
+-- | 
+data ChatCompletionRequestMessageContentPart = ChatCompletionRequestMessageContentPart
+  { chatCompletionRequestMessageContentPartType :: Text -- ^ The type of the content part.
+  , chatCompletionRequestMessageContentPartText :: Maybe Text -- ^ The text content.
+  , chatCompletionRequestMessageContentPartImageUnderscoreurl :: Maybe ChatCompletionRequestMessageContentPartImageImageUrl -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessageContentPart where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPart")
+instance ToJSON ChatCompletionRequestMessageContentPart where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPart")
+
+
+-- | 
+data ChatCompletionRequestMessageContentPartImage = ChatCompletionRequestMessageContentPartImage
+  { chatCompletionRequestMessageContentPartImageType :: Text -- ^ The type of the content part.
+  , chatCompletionRequestMessageContentPartImageImageUnderscoreurl :: ChatCompletionRequestMessageContentPartImageImageUrl -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessageContentPartImage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartImage")
+instance ToJSON ChatCompletionRequestMessageContentPartImage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartImage")
+
+
+-- | 
+data ChatCompletionRequestMessageContentPartImageImageUrl = ChatCompletionRequestMessageContentPartImageImageUrl
+  { chatCompletionRequestMessageContentPartImageImageUrlUrl :: Text -- ^ Either a URL of the image or the base64 encoded image data.
+  , chatCompletionRequestMessageContentPartImageImageUrlDetail :: Maybe Text -- ^ Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding).
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessageContentPartImageImageUrl where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartImageImageUrl")
+instance ToJSON ChatCompletionRequestMessageContentPartImageImageUrl where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartImageImageUrl")
+
+
+-- | 
+data ChatCompletionRequestMessageContentPartText = ChatCompletionRequestMessageContentPartText
+  { chatCompletionRequestMessageContentPartTextType :: Text -- ^ The type of the content part.
+  , chatCompletionRequestMessageContentPartTextText :: Text -- ^ The text content.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestMessageContentPartText where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartText")
+instance ToJSON ChatCompletionRequestMessageContentPartText where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestMessageContentPartText")
+
+
+-- | 
+data ChatCompletionRequestSystemMessage = ChatCompletionRequestSystemMessage
+  { chatCompletionRequestSystemMessageContent :: Text -- ^ The contents of the system message.
+  , chatCompletionRequestSystemMessageRole :: Text -- ^ The role of the messages author, in this case `system`.
+  , chatCompletionRequestSystemMessageName :: Maybe Text -- ^ An optional name for the participant. Provides the model information to differentiate between participants of the same role.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestSystemMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestSystemMessage")
+instance ToJSON ChatCompletionRequestSystemMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestSystemMessage")
+
+
+-- | 
+data ChatCompletionRequestToolMessage = ChatCompletionRequestToolMessage
+  { chatCompletionRequestToolMessageRole :: Text -- ^ The role of the messages author, in this case `tool`.
+  , chatCompletionRequestToolMessageContent :: Text -- ^ The contents of the tool message.
+  , chatCompletionRequestToolMessageToolUnderscorecallUnderscoreid :: Text -- ^ Tool call that this message is responding to.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestToolMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestToolMessage")
+instance ToJSON ChatCompletionRequestToolMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestToolMessage")
+
+
+-- | 
+data ChatCompletionRequestUserMessage = ChatCompletionRequestUserMessage
+  { chatCompletionRequestUserMessageContent :: ChatCompletionRequestUserMessageContent -- ^ 
+  , chatCompletionRequestUserMessageRole :: Text -- ^ The role of the messages author, in this case `user`.
+  , chatCompletionRequestUserMessageName :: Maybe Text -- ^ An optional name for the participant. Provides the model information to differentiate between participants of the same role.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestUserMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestUserMessage")
+instance ToJSON ChatCompletionRequestUserMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestUserMessage")
+
+
+-- | The contents of the user message. 
+data ChatCompletionRequestUserMessageContent = ChatCompletionRequestUserMessageContent
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRequestUserMessageContent where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRequestUserMessageContent")
+instance ToJSON ChatCompletionRequestUserMessageContent where
+  toJSON :: ChatCompletionRequestUserMessageContent -> Value
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRequestUserMessageContent")
+
+
+-- | A chat completion message generated by the model.
+data ChatCompletionResponseMessage = ChatCompletionResponseMessage
+  { chatCompletionResponseMessageContent :: Maybe Text -- ^ The contents of the message.
+  , chatCompletionResponseMessageToolUnderscorecalls :: Maybe [ChatCompletionMessageToolCall] -- ^ The tool calls generated by the model, such as function calls.
+  , chatCompletionResponseMessageRole :: Text -- ^ The role of the author of this message.
+  , chatCompletionResponseMessageFunctionUnderscorecall :: Maybe ChatCompletionRequestAssistantMessageFunctionCall -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionResponseMessage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionResponseMessage")
+instance ToJSON ChatCompletionResponseMessage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionResponseMessage")
+
+
+-- | The role of the author of a message
+data ChatCompletionRole = ChatCompletionRole
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionRole where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionRole")
+instance ToJSON ChatCompletionRole where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionRole")
+
+
+-- | A chat completion delta generated by streamed model responses.
+data ChatCompletionStreamResponseDelta = ChatCompletionStreamResponseDelta
+  { chatCompletionStreamResponseDeltaContent :: Maybe Text -- ^ The contents of the chunk message.
+  , chatCompletionStreamResponseDeltaFunctionUnderscorecall :: Maybe ChatCompletionStreamResponseDeltaFunctionCall -- ^ 
+  , chatCompletionStreamResponseDeltaToolUnderscorecalls :: Maybe [ChatCompletionMessageToolCallChunk] -- ^ 
+  , chatCompletionStreamResponseDeltaRole :: Maybe Text -- ^ The role of the author of this message.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionStreamResponseDelta where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionStreamResponseDelta")
+instance ToJSON ChatCompletionStreamResponseDelta where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionStreamResponseDelta")
+
+
+-- | Deprecated and replaced by &#x60;tool_calls&#x60;. The name and arguments of a function that should be called, as generated by the model.
+data ChatCompletionStreamResponseDeltaFunctionCall = ChatCompletionStreamResponseDeltaFunctionCall
+  { chatCompletionStreamResponseDeltaFunctionCallArguments :: Maybe Text -- ^ The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
+  , chatCompletionStreamResponseDeltaFunctionCallName :: Maybe Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionStreamResponseDeltaFunctionCall where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionStreamResponseDeltaFunctionCall")
+instance ToJSON ChatCompletionStreamResponseDeltaFunctionCall where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionStreamResponseDeltaFunctionCall")
+
+
+-- | 
+data ChatCompletionTokenLogprob = ChatCompletionTokenLogprob
+  { chatCompletionTokenLogprobToken :: Text -- ^ The token.
+  , chatCompletionTokenLogprobLogprob :: Double -- ^ The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
+  , chatCompletionTokenLogprobBytes :: [Int] -- ^ A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
+  , chatCompletionTokenLogprobTopUnderscorelogprobs :: [ChatCompletionTokenLogprobTopLogprobsInner] -- ^ List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionTokenLogprob where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionTokenLogprob")
+instance ToJSON ChatCompletionTokenLogprob where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionTokenLogprob")
+
+
+-- | 
+data ChatCompletionTokenLogprobTopLogprobsInner = ChatCompletionTokenLogprobTopLogprobsInner
+  { chatCompletionTokenLogprobTopLogprobsInnerToken :: Text -- ^ The token.
+  , chatCompletionTokenLogprobTopLogprobsInnerLogprob :: Double -- ^ The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
+  , chatCompletionTokenLogprobTopLogprobsInnerBytes :: [Int] -- ^ A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionTokenLogprobTopLogprobsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionTokenLogprobTopLogprobsInner")
+instance ToJSON ChatCompletionTokenLogprobTopLogprobsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionTokenLogprobTopLogprobsInner")
+
+
+-- | 
+data ChatCompletionTool = ChatCompletionTool
+  { chatCompletionToolType :: Text -- ^ The type of the tool. Currently, only `function` is supported.
+  , chatCompletionToolFunction :: FunctionObject -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionTool where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionTool")
+instance ToJSON ChatCompletionTool where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionTool")
+
+
+-- | Controls which (if any) function is called by the model. &#x60;none&#x60; means the model will not call a function and instead generates a message. &#x60;auto&#x60; means the model can pick between generating a message or calling a function. Specifying a particular function via &#x60;{\&quot;type\&quot;: \&quot;function\&quot;, \&quot;function\&quot;: {\&quot;name\&quot;: \&quot;my_function\&quot;}}&#x60; forces the model to call that function.  &#x60;none&#x60; is the default when no functions are present. &#x60;auto&#x60; is the default if functions are present. 
+data ChatCompletionToolChoiceOption = ChatCompletionToolChoiceOption
+  { chatCompletionToolChoiceOptionType :: Text -- ^ The type of the tool. Currently, only `function` is supported.
+  , chatCompletionToolChoiceOptionFunction :: ChatCompletionNamedToolChoiceFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ChatCompletionToolChoiceOption where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "chatCompletionToolChoiceOption")
+instance ToJSON ChatCompletionToolChoiceOption where
+  toJSON = genericToJSON (removeFieldLabelPrefix "chatCompletionToolChoiceOption")
+
+
+-- | Usage statistics for the completion request.
+data CompletionUsage = CompletionUsage
+  { completionUsageCompletionUnderscoretokens :: Int -- ^ Number of tokens in the generated completion.
+  , completionUsagePromptUnderscoretokens :: Int -- ^ Number of tokens in the prompt.
+  , completionUsageTotalUnderscoretokens :: Int -- ^ Total number of tokens used in the request (prompt + completion).
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CompletionUsage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "completionUsage")
+instance ToJSON CompletionUsage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "completionUsage")
+
+
+-- | 
+data CreateAssistantFileRequest = CreateAssistantFileRequest
+  { createAssistantFileRequestFileUnderscoreid :: Text -- ^ A [File](/docs/api-reference/files) ID (with `purpose=\"assistants\"`) that the assistant should use. Useful for tools like `retrieval` and `code_interpreter` that can access files.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateAssistantFileRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createAssistantFileRequest")
+instance ToJSON CreateAssistantFileRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createAssistantFileRequest")
+
+
+-- | 
+data CreateAssistantRequest = CreateAssistantRequest
+  { createAssistantRequestModel :: CreateAssistantRequestModel -- ^ 
+  , createAssistantRequestName :: Maybe Text -- ^ The name of the assistant. The maximum length is 256 characters. 
+  , createAssistantRequestDescription :: Maybe Text -- ^ The description of the assistant. The maximum length is 512 characters. 
+  , createAssistantRequestInstructions :: Maybe Text -- ^ The system instructions that the assistant uses. The maximum length is 32768 characters. 
+  , createAssistantRequestTools :: Maybe [AssistantObjectToolsInner] -- ^ A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. 
+  , createAssistantRequestFileUnderscoreids :: Maybe [Text] -- ^ A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. 
+  , createAssistantRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateAssistantRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createAssistantRequest")
+instance ToJSON CreateAssistantRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createAssistantRequest")
+
+
+-- | ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. 
+data CreateAssistantRequestModel = CreateAssistantRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateAssistantRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createAssistantRequestModel")
+instance ToJSON CreateAssistantRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createAssistantRequestModel")
+
+
+-- | Represents a chat completion response returned by model, based on the provided input.
+data CreateChatCompletionFunctionResponse = CreateChatCompletionFunctionResponse
+  { createChatCompletionFunctionResponseId :: Text -- ^ A unique identifier for the chat completion.
+  , createChatCompletionFunctionResponseChoices :: [CreateChatCompletionFunctionResponseChoicesInner] -- ^ A list of chat completion choices. Can be more than one if `n` is greater than 1.
+  , createChatCompletionFunctionResponseCreated :: Int -- ^ The Unix timestamp (in seconds) of when the chat completion was created.
+  , createChatCompletionFunctionResponseModel :: Text -- ^ The model used for the chat completion.
+  , createChatCompletionFunctionResponseSystemUnderscorefingerprint :: Maybe Text -- ^ This fingerprint represents the backend configuration that the model runs with.  Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. 
+  , createChatCompletionFunctionResponseObject :: Text -- ^ The object type, which is always `chat.completion`.
+  , createChatCompletionFunctionResponseUsage :: Maybe CompletionUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionFunctionResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionFunctionResponse")
+instance ToJSON CreateChatCompletionFunctionResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionFunctionResponse")
+
+
+-- | 
+data CreateChatCompletionFunctionResponseChoicesInner = CreateChatCompletionFunctionResponseChoicesInner
+  { createChatCompletionFunctionResponseChoicesInnerFinishUnderscorereason :: Text -- ^ The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function. 
+  , createChatCompletionFunctionResponseChoicesInnerIndex :: Int -- ^ The index of the choice in the list of choices.
+  , createChatCompletionFunctionResponseChoicesInnerMessage :: ChatCompletionResponseMessage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionFunctionResponseChoicesInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionFunctionResponseChoicesInner")
+instance ToJSON CreateChatCompletionFunctionResponseChoicesInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionFunctionResponseChoicesInner")
+
+
+-- | 
+data CreateChatCompletionRequest = CreateChatCompletionRequest
+  { createChatCompletionRequestMessages :: [ChatCompletionRequestMessage] -- ^ A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).
+  , createChatCompletionRequestModel :: CreateChatCompletionRequestModel -- ^ 
+  , createChatCompletionRequestFrequencyUnderscorepenalty :: Maybe Double -- ^ Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.  [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) 
+  , createChatCompletionRequestLogitUnderscorebias :: Maybe (Map.Map String Int) -- ^ Modify the likelihood of specified tokens appearing in the completion.  Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. 
+  , createChatCompletionRequestLogprobs :: Maybe Bool -- ^ Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model.
+  , createChatCompletionRequestTopUnderscorelogprobs :: Maybe Int -- ^ An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.
+  , createChatCompletionRequestMaxUnderscoretokens :: Maybe Int -- ^ The maximum number of [tokens](/tokenizer) that can be generated in the chat completion.  The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. 
+  , createChatCompletionRequestN :: Maybe Int -- ^ How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
+  , createChatCompletionRequestPresenceUnderscorepenalty :: Maybe Double -- ^ Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.  [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) 
+  , createChatCompletionRequestResponseUnderscoreformat :: Maybe CreateChatCompletionRequestResponseFormat -- ^ 
+  , createChatCompletionRequestSeed :: Maybe Int -- ^ This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. 
+  , createChatCompletionRequestStop :: Maybe CreateChatCompletionRequestStop -- ^ 
+  , createChatCompletionRequestStream :: Maybe Bool -- ^ If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). 
+  , createChatCompletionRequestTemperature :: Maybe Double -- ^ What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.  We generally recommend altering this or `top_p` but not both. 
+  , createChatCompletionRequestTopUnderscorep :: Maybe Double -- ^ An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.  We generally recommend altering this or `temperature` but not both. 
+  , createChatCompletionRequestTools :: Maybe [ChatCompletionTool] -- ^ A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. 
+  , createChatCompletionRequestToolUnderscorechoice :: Maybe ChatCompletionToolChoiceOption -- ^ 
+  , createChatCompletionRequestUser :: Maybe Text -- ^ A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). 
+  , createChatCompletionRequestFunctionUnderscorecall :: Maybe CreateChatCompletionRequestFunctionCall -- ^ 
+  , createChatCompletionRequestFunctions :: Maybe [ChatCompletionFunctions] -- ^ Deprecated in favor of `tools`.  A list of functions the model may generate JSON inputs for. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionRequest")
+instance ToJSON CreateChatCompletionRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionRequest")
+
+
+-- | Deprecated in favor of &#x60;tool_choice&#x60;.  Controls which (if any) function is called by the model. &#x60;none&#x60; means the model will not call a function and instead generates a message. &#x60;auto&#x60; means the model can pick between generating a message or calling a function. Specifying a particular function via &#x60;{\&quot;name\&quot;: \&quot;my_function\&quot;}&#x60; forces the model to call that function.  &#x60;none&#x60; is the default when no functions are present. &#x60;auto&#x60; is the default if functions are present. 
+data CreateChatCompletionRequestFunctionCall = CreateChatCompletionRequestFunctionCall
+  { createChatCompletionRequestFunctionCallName :: Text -- ^ The name of the function to call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionRequestFunctionCall where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionRequestFunctionCall")
+instance ToJSON CreateChatCompletionRequestFunctionCall where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionRequestFunctionCall")
+
+
+-- | ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.
+newtype CreateChatCompletionRequestModel = CreateChatCompletionRequestModel Text deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionRequestModel")
+instance ToJSON CreateChatCompletionRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionRequestModel")
+
+
+-- | An object specifying the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than &#x60;gpt-3.5-turbo-1106&#x60;.  Setting to &#x60;{ \&quot;type\&quot;: \&quot;json_object\&quot; }&#x60; enables JSON mode, which guarantees the message the model generates is valid JSON.  **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \&quot;stuck\&quot; request. Also note that the message content may be partially cut off if &#x60;finish_reason&#x3D;\&quot;length\&quot;&#x60;, which indicates the generation exceeded &#x60;max_tokens&#x60; or the conversation exceeded the max context length. 
+data CreateChatCompletionRequestResponseFormat = CreateChatCompletionRequestResponseFormat
+  { createChatCompletionRequestResponseFormatType :: Maybe Text -- ^ Must be one of `text` or `json_object`.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionRequestResponseFormat where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionRequestResponseFormat")
+instance ToJSON CreateChatCompletionRequestResponseFormat where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionRequestResponseFormat")
+
+
+-- | Up to 4 sequences where the API will stop generating further tokens. 
+data CreateChatCompletionRequestStop = CreateChatCompletionRequestStop
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionRequestStop where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionRequestStop")
+instance ToJSON CreateChatCompletionRequestStop where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionRequestStop")
+
+
+-- | Represents a chat completion response returned by model, based on the provided input.
+data CreateChatCompletionResponse = CreateChatCompletionResponse
+  { createChatCompletionResponseId :: Text -- ^ A unique identifier for the chat completion.
+  , createChatCompletionResponseChoices :: [CreateChatCompletionResponseChoicesInner] -- ^ A list of chat completion choices. Can be more than one if `n` is greater than 1.
+  , createChatCompletionResponseCreated :: Int -- ^ The Unix timestamp (in seconds) of when the chat completion was created.
+  , createChatCompletionResponseModel :: Text -- ^ The model used for the chat completion.
+  , createChatCompletionResponseSystemUnderscorefingerprint :: Maybe Text -- ^ This fingerprint represents the backend configuration that the model runs with.  Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. 
+  , createChatCompletionResponseObject :: Text -- ^ The object type, which is always `chat.completion`.
+  , createChatCompletionResponseUsage :: Maybe CompletionUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionResponse")
+instance ToJSON CreateChatCompletionResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionResponse")
+
+
+-- | 
+data CreateChatCompletionResponseChoicesInner = CreateChatCompletionResponseChoicesInner
+  { createChatCompletionResponseChoicesInnerFinishUnderscorereason :: Text -- ^ The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. 
+  , createChatCompletionResponseChoicesInnerIndex :: Int -- ^ The index of the choice in the list of choices.
+  , createChatCompletionResponseChoicesInnerMessage :: ChatCompletionResponseMessage -- ^ 
+  , createChatCompletionResponseChoicesInnerLogprobs :: Maybe CreateChatCompletionResponseChoicesInnerLogprobs -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionResponseChoicesInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionResponseChoicesInner")
+instance ToJSON CreateChatCompletionResponseChoicesInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionResponseChoicesInner")
+
+
+-- | Log probability information for the choice.
+data CreateChatCompletionResponseChoicesInnerLogprobs = CreateChatCompletionResponseChoicesInnerLogprobs
+  { createChatCompletionResponseChoicesInnerLogprobsContent :: [ChatCompletionTokenLogprob] -- ^ A list of message content tokens with log probability information.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionResponseChoicesInnerLogprobs where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionResponseChoicesInnerLogprobs")
+instance ToJSON CreateChatCompletionResponseChoicesInnerLogprobs where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionResponseChoicesInnerLogprobs")
+
+
+-- | Represents a streamed chunk of a chat completion response returned by model, based on the provided input.
+data CreateChatCompletionStreamResponse = CreateChatCompletionStreamResponse
+  { createChatCompletionStreamResponseId :: Text -- ^ A unique identifier for the chat completion. Each chunk has the same ID.
+  , createChatCompletionStreamResponseChoices :: [CreateChatCompletionStreamResponseChoicesInner] -- ^ A list of chat completion choices. Can be more than one if `n` is greater than 1.
+  , createChatCompletionStreamResponseCreated :: Int -- ^ The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
+  , createChatCompletionStreamResponseModel :: Text -- ^ The model to generate the completion.
+  , createChatCompletionStreamResponseSystemUnderscorefingerprint :: Maybe Text -- ^ This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. 
+  , createChatCompletionStreamResponseObject :: Text -- ^ The object type, which is always `chat.completion.chunk`.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionStreamResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionStreamResponse")
+instance ToJSON CreateChatCompletionStreamResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionStreamResponse")
+
+
+-- | 
+data CreateChatCompletionStreamResponseChoicesInner = CreateChatCompletionStreamResponseChoicesInner
+  { createChatCompletionStreamResponseChoicesInnerDelta :: ChatCompletionStreamResponseDelta -- ^ 
+  , createChatCompletionStreamResponseChoicesInnerLogprobs :: Maybe CreateChatCompletionResponseChoicesInnerLogprobs -- ^ 
+  , createChatCompletionStreamResponseChoicesInnerFinishUnderscorereason :: Text -- ^ The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. 
+  , createChatCompletionStreamResponseChoicesInnerIndex :: Int -- ^ The index of the choice in the list of choices.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateChatCompletionStreamResponseChoicesInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createChatCompletionStreamResponseChoicesInner")
+instance ToJSON CreateChatCompletionStreamResponseChoicesInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createChatCompletionStreamResponseChoicesInner")
+
+
+-- | 
+data CreateCompletionRequest = CreateCompletionRequest
+  { createCompletionRequestModel :: CreateCompletionRequestModel -- ^ 
+  , createCompletionRequestPrompt :: CreateCompletionRequestPrompt -- ^ 
+  , createCompletionRequestBestUnderscoreof :: Maybe Int -- ^ Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.  When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.  **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. 
+  , createCompletionRequestEcho :: Maybe Bool -- ^ Echo back the prompt in addition to the completion 
+  , createCompletionRequestFrequencyUnderscorepenalty :: Maybe Double -- ^ Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.  [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) 
+  , createCompletionRequestLogitUnderscorebias :: Maybe (Map.Map String Int) -- ^ Modify the likelihood of specified tokens appearing in the completion.  Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.  As an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated. 
+  , createCompletionRequestLogprobs :: Maybe Int -- ^ Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.  The maximum value for `logprobs` is 5. 
+  , createCompletionRequestMaxUnderscoretokens :: Maybe Int -- ^ The maximum number of [tokens](/tokenizer) that can be generated in the completion.  The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. 
+  , createCompletionRequestN :: Maybe Int -- ^ How many completions to generate for each prompt.  **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. 
+  , createCompletionRequestPresenceUnderscorepenalty :: Maybe Double -- ^ Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.  [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) 
+  , createCompletionRequestSeed :: Maybe Int -- ^ If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.  Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. 
+  , createCompletionRequestStop :: Maybe CreateCompletionRequestStop -- ^ 
+  , createCompletionRequestStream :: Maybe Bool -- ^ Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). 
+  , createCompletionRequestSuffix :: Maybe Text -- ^ The suffix that comes after a completion of inserted text.
+  , createCompletionRequestTemperature :: Maybe Double -- ^ What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.  We generally recommend altering this or `top_p` but not both. 
+  , createCompletionRequestTopUnderscorep :: Maybe Double -- ^ An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.  We generally recommend altering this or `temperature` but not both. 
+  , createCompletionRequestUser :: Maybe Text -- ^ A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionRequest")
+instance ToJSON CreateCompletionRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionRequest")
+
+
+-- | ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. 
+data CreateCompletionRequestModel = CreateCompletionRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionRequestModel")
+instance ToJSON CreateCompletionRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionRequestModel")
+
+
+-- | The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.  Note that &lt;|endoftext|&gt; is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. 
+data CreateCompletionRequestPrompt = CreateCompletionRequestPrompt
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionRequestPrompt where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionRequestPrompt")
+instance ToJSON CreateCompletionRequestPrompt where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionRequestPrompt")
+
+
+-- | Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. 
+data CreateCompletionRequestStop = CreateCompletionRequestStop
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionRequestStop where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionRequestStop")
+instance ToJSON CreateCompletionRequestStop where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionRequestStop")
+
+
+-- | Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint). 
+data CreateCompletionResponse = CreateCompletionResponse
+  { createCompletionResponseId :: Text -- ^ A unique identifier for the completion.
+  , createCompletionResponseChoices :: [CreateCompletionResponseChoicesInner] -- ^ The list of completion choices the model generated for the input prompt.
+  , createCompletionResponseCreated :: Int -- ^ The Unix timestamp (in seconds) of when the completion was created.
+  , createCompletionResponseModel :: Text -- ^ The model used for completion.
+  , createCompletionResponseSystemUnderscorefingerprint :: Maybe Text -- ^ This fingerprint represents the backend configuration that the model runs with.  Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. 
+  , createCompletionResponseObject :: Text -- ^ The object type, which is always \"text_completion\"
+  , createCompletionResponseUsage :: Maybe CompletionUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionResponse")
+instance ToJSON CreateCompletionResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionResponse")
+
+
+-- | 
+data CreateCompletionResponseChoicesInner = CreateCompletionResponseChoicesInner
+  { createCompletionResponseChoicesInnerFinishUnderscorereason :: Text -- ^ The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters. 
+  , createCompletionResponseChoicesInnerIndex :: Int -- ^ 
+  , createCompletionResponseChoicesInnerLogprobs :: Maybe CreateCompletionResponseChoicesInnerLogprobs -- ^ 
+  , createCompletionResponseChoicesInnerText :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionResponseChoicesInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionResponseChoicesInner")
+instance ToJSON CreateCompletionResponseChoicesInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionResponseChoicesInner")
+
+
+-- | 
+data CreateCompletionResponseChoicesInnerLogprobs = CreateCompletionResponseChoicesInnerLogprobs
+  { createCompletionResponseChoicesInnerLogprobsTextUnderscoreoffset :: Maybe [Int] -- ^ 
+  , createCompletionResponseChoicesInnerLogprobsTokenUnderscorelogprobs :: Maybe [Double] -- ^ 
+  , createCompletionResponseChoicesInnerLogprobsTokens :: Maybe [Text] -- ^ 
+  , createCompletionResponseChoicesInnerLogprobsTopUnderscorelogprobs :: Maybe [(Map.Map String Double)] -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateCompletionResponseChoicesInnerLogprobs where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createCompletionResponseChoicesInnerLogprobs")
+instance ToJSON CreateCompletionResponseChoicesInnerLogprobs where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createCompletionResponseChoicesInnerLogprobs")
+
+
+-- | 
+data CreateEmbeddingRequest = CreateEmbeddingRequest
+  { createEmbeddingRequestInput :: CreateEmbeddingRequestInput -- ^ 
+  , createEmbeddingRequestModel :: CreateEmbeddingRequestModel -- ^ 
+  , createEmbeddingRequestEncodingUnderscoreformat :: Maybe Text -- ^ The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
+  , createEmbeddingRequestDimensions :: Maybe Int -- ^ The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models. 
+  , createEmbeddingRequestUser :: Maybe Text -- ^ A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateEmbeddingRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createEmbeddingRequest")
+instance ToJSON CreateEmbeddingRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createEmbeddingRequest")
+
+
+-- | Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for &#x60;text-embedding-ada-002&#x60;), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. 
+data CreateEmbeddingRequestInput = CreateEmbeddingRequestInput
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateEmbeddingRequestInput where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createEmbeddingRequestInput")
+instance ToJSON CreateEmbeddingRequestInput where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createEmbeddingRequestInput")
+
+
+-- | ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. 
+data CreateEmbeddingRequestModel = CreateEmbeddingRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateEmbeddingRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createEmbeddingRequestModel")
+instance ToJSON CreateEmbeddingRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createEmbeddingRequestModel")
+
+
+-- | 
+data CreateEmbeddingResponse = CreateEmbeddingResponse
+  { createEmbeddingResponseData :: [Embedding] -- ^ The list of embeddings generated by the model.
+  , createEmbeddingResponseModel :: Text -- ^ The name of the model used to generate the embedding.
+  , createEmbeddingResponseObject :: Text -- ^ The object type, which is always \"list\".
+  , createEmbeddingResponseUsage :: CreateEmbeddingResponseUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateEmbeddingResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createEmbeddingResponse")
+instance ToJSON CreateEmbeddingResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createEmbeddingResponse")
+
+
+-- | The usage information for the request.
+data CreateEmbeddingResponseUsage = CreateEmbeddingResponseUsage
+  { createEmbeddingResponseUsagePromptUnderscoretokens :: Int -- ^ The number of tokens used by the prompt.
+  , createEmbeddingResponseUsageTotalUnderscoretokens :: Int -- ^ The total number of tokens used by the request.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateEmbeddingResponseUsage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createEmbeddingResponseUsage")
+instance ToJSON CreateEmbeddingResponseUsage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createEmbeddingResponseUsage")
+
+
+-- | 
+data CreateFineTuningJobRequest = CreateFineTuningJobRequest
+  { createFineTuningJobRequestModel :: CreateFineTuningJobRequestModel -- ^ 
+  , createFineTuningJobRequestTrainingUnderscorefile :: Text -- ^ The ID of an uploaded file that contains training data.  See [upload file](/docs/api-reference/files/upload) for how to upload a file.  Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.  See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. 
+  , createFineTuningJobRequestHyperparameters :: Maybe CreateFineTuningJobRequestHyperparameters -- ^ 
+  , createFineTuningJobRequestSuffix :: Maybe Text -- ^ A string of up to 18 characters that will be added to your fine-tuned model name.  For example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`. 
+  , createFineTuningJobRequestValidationUnderscorefile :: Maybe Text -- ^ The ID of an uploaded file that contains validation data.  If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the fine-tuning results file. The same data should not be present in both train and validation files.  Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.  See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequest")
+instance ToJSON CreateFineTuningJobRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequest")
+
+
+-- | The hyperparameters used for the fine-tuning job.
+data CreateFineTuningJobRequestHyperparameters = CreateFineTuningJobRequestHyperparameters
+  { createFineTuningJobRequestHyperparametersBatchUnderscoresize :: Maybe CreateFineTuningJobRequestHyperparametersBatchSize -- ^ 
+  , createFineTuningJobRequestHyperparametersLearningUnderscorerateUnderscoremultiplier :: Maybe CreateFineTuningJobRequestHyperparametersLearningRateMultiplier -- ^ 
+  , createFineTuningJobRequestHyperparametersNUnderscoreepochs :: Maybe CreateFineTuningJobRequestHyperparametersNEpochs -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequestHyperparameters where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparameters")
+instance ToJSON CreateFineTuningJobRequestHyperparameters where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparameters")
+
+
+-- | Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. 
+data CreateFineTuningJobRequestHyperparametersBatchSize = CreateFineTuningJobRequestHyperparametersBatchSize
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequestHyperparametersBatchSize where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersBatchSize")
+instance ToJSON CreateFineTuningJobRequestHyperparametersBatchSize where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersBatchSize")
+
+
+-- | Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. 
+data CreateFineTuningJobRequestHyperparametersLearningRateMultiplier = CreateFineTuningJobRequestHyperparametersLearningRateMultiplier
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequestHyperparametersLearningRateMultiplier where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersLearningRateMultiplier")
+instance ToJSON CreateFineTuningJobRequestHyperparametersLearningRateMultiplier where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersLearningRateMultiplier")
+
+
+-- | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. 
+data CreateFineTuningJobRequestHyperparametersNEpochs = CreateFineTuningJobRequestHyperparametersNEpochs
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequestHyperparametersNEpochs where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersNEpochs")
+instance ToJSON CreateFineTuningJobRequestHyperparametersNEpochs where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequestHyperparametersNEpochs")
+
+
+-- | The name of the model to fine-tune. You can select one of the [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned). 
+data CreateFineTuningJobRequestModel = CreateFineTuningJobRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateFineTuningJobRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createFineTuningJobRequestModel")
+instance ToJSON CreateFineTuningJobRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createFineTuningJobRequestModel")
+
+
+-- | 
+data CreateImageRequest = CreateImageRequest
+  { createImageRequestPrompt :: Text -- ^ A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.
+  , createImageRequestModel :: Maybe CreateImageRequestModel -- ^ 
+  , createImageRequestN :: Maybe Int -- ^ The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported.
+  , createImageRequestQuality :: Maybe Text -- ^ The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`.
+  , createImageRequestResponseUnderscoreformat :: Maybe Text -- ^ The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
+  , createImageRequestSize :: Maybe Text -- ^ The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models.
+  , createImageRequestStyle :: Maybe Text -- ^ The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`.
+  , createImageRequestUser :: Maybe Text -- ^ A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateImageRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createImageRequest")
+instance ToJSON CreateImageRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createImageRequest")
+
+
+-- | The model to use for image generation.
+data CreateImageRequestModel = CreateImageRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateImageRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createImageRequestModel")
+instance ToJSON CreateImageRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createImageRequestModel")
+
+
+-- | 
+data CreateMessageRequest = CreateMessageRequest
+  { createMessageRequestRole :: Text -- ^ The role of the entity that is creating the message. Currently only `user` is supported.
+  , createMessageRequestContent :: Text -- ^ The content of the message.
+  , createMessageRequestFileUnderscoreids :: Maybe [Text] -- ^ A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files.
+  , createMessageRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateMessageRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createMessageRequest")
+instance ToJSON CreateMessageRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createMessageRequest")
+
+
+-- | 
+data CreateModerationRequest = CreateModerationRequest
+  { createModerationRequestInput :: CreateModerationRequestInput -- ^ 
+  , createModerationRequestModel :: Maybe CreateModerationRequestModel -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationRequest")
+instance ToJSON CreateModerationRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationRequest")
+
+
+-- | The input text to classify
+data CreateModerationRequestInput = CreateModerationRequestInput
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationRequestInput where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationRequestInput")
+instance ToJSON CreateModerationRequestInput where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationRequestInput")
+
+
+-- | Two content moderations models are available: &#x60;text-moderation-stable&#x60; and &#x60;text-moderation-latest&#x60;.  The default is &#x60;text-moderation-latest&#x60; which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use &#x60;text-moderation-stable&#x60;, we will provide advanced notice before updating the model. Accuracy of &#x60;text-moderation-stable&#x60; may be slightly lower than for &#x60;text-moderation-latest&#x60;. 
+data CreateModerationRequestModel = CreateModerationRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationRequestModel")
+instance ToJSON CreateModerationRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationRequestModel")
+
+
+-- | Represents if a given text input is potentially harmful.
+data CreateModerationResponse = CreateModerationResponse
+  { createModerationResponseId :: Text -- ^ The unique identifier for the moderation request.
+  , createModerationResponseModel :: Text -- ^ The model used to generate the moderation results.
+  , createModerationResponseResults :: [CreateModerationResponseResultsInner] -- ^ A list of moderation objects.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationResponse")
+instance ToJSON CreateModerationResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationResponse")
+
+
+-- | 
+data CreateModerationResponseResultsInner = CreateModerationResponseResultsInner
+  { createModerationResponseResultsInnerFlagged :: Bool -- ^ Whether any of the below categories are flagged.
+  , createModerationResponseResultsInnerCategories :: CreateModerationResponseResultsInnerCategories -- ^ 
+  , createModerationResponseResultsInnerCategoryUnderscorescores :: CreateModerationResponseResultsInnerCategoryScores -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationResponseResultsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationResponseResultsInner")
+instance ToJSON CreateModerationResponseResultsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationResponseResultsInner")
+
+
+-- | A list of the categories, and whether they are flagged or not.
+data CreateModerationResponseResultsInnerCategories = CreateModerationResponseResultsInnerCategories
+  { createModerationResponseResultsInnerCategoriesHate :: Bool -- ^ Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment.
+  , createModerationResponseResultsInnerCategoriesHateSlashthreatening :: Bool -- ^ Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste.
+  , createModerationResponseResultsInnerCategoriesHarassment :: Bool -- ^ Content that expresses, incites, or promotes harassing language towards any target.
+  , createModerationResponseResultsInnerCategoriesHarassmentSlashthreatening :: Bool -- ^ Harassment content that also includes violence or serious harm towards any target.
+  , createModerationResponseResultsInnerCategoriesSelfDashharm :: Bool -- ^ Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders.
+  , createModerationResponseResultsInnerCategoriesSelfDashharmSlashintent :: Bool -- ^ Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders.
+  , createModerationResponseResultsInnerCategoriesSelfDashharmSlashinstructions :: Bool -- ^ Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts.
+  , createModerationResponseResultsInnerCategoriesSexual :: Bool -- ^ Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).
+  , createModerationResponseResultsInnerCategoriesSexualSlashminors :: Bool -- ^ Sexual content that includes an individual who is under 18 years old.
+  , createModerationResponseResultsInnerCategoriesViolence :: Bool -- ^ Content that depicts death, violence, or physical injury.
+  , createModerationResponseResultsInnerCategoriesViolenceSlashgraphic :: Bool -- ^ Content that depicts death, violence, or physical injury in graphic detail.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationResponseResultsInnerCategories where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationResponseResultsInnerCategories")
+instance ToJSON CreateModerationResponseResultsInnerCategories where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationResponseResultsInnerCategories")
+
+
+-- | A list of the categories along with their scores as predicted by model.
+data CreateModerationResponseResultsInnerCategoryScores = CreateModerationResponseResultsInnerCategoryScores
+  { createModerationResponseResultsInnerCategoryScoresHate :: Double -- ^ The score for the category 'hate'.
+  , createModerationResponseResultsInnerCategoryScoresHateSlashthreatening :: Double -- ^ The score for the category 'hate/threatening'.
+  , createModerationResponseResultsInnerCategoryScoresHarassment :: Double -- ^ The score for the category 'harassment'.
+  , createModerationResponseResultsInnerCategoryScoresHarassmentSlashthreatening :: Double -- ^ The score for the category 'harassment/threatening'.
+  , createModerationResponseResultsInnerCategoryScoresSelfDashharm :: Double -- ^ The score for the category 'self-harm'.
+  , createModerationResponseResultsInnerCategoryScoresSelfDashharmSlashintent :: Double -- ^ The score for the category 'self-harm/intent'.
+  , createModerationResponseResultsInnerCategoryScoresSelfDashharmSlashinstructions :: Double -- ^ The score for the category 'self-harm/instructions'.
+  , createModerationResponseResultsInnerCategoryScoresSexual :: Double -- ^ The score for the category 'sexual'.
+  , createModerationResponseResultsInnerCategoryScoresSexualSlashminors :: Double -- ^ The score for the category 'sexual/minors'.
+  , createModerationResponseResultsInnerCategoryScoresViolence :: Double -- ^ The score for the category 'violence'.
+  , createModerationResponseResultsInnerCategoryScoresViolenceSlashgraphic :: Double -- ^ The score for the category 'violence/graphic'.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateModerationResponseResultsInnerCategoryScores where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createModerationResponseResultsInnerCategoryScores")
+instance ToJSON CreateModerationResponseResultsInnerCategoryScores where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createModerationResponseResultsInnerCategoryScores")
+
+
+-- | 
+data CreateRunRequest = CreateRunRequest
+  { createRunRequestAssistantUnderscoreid :: Text -- ^ The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.
+  , createRunRequestModel :: Maybe Text -- ^ The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
+  , createRunRequestInstructions :: Maybe Text -- ^ Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis.
+  , createRunRequestAdditionalUnderscoreinstructions :: Maybe Text -- ^ Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
+  , createRunRequestTools :: Maybe [AssistantObjectToolsInner] -- ^ Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
+  , createRunRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateRunRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createRunRequest")
+instance ToJSON CreateRunRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createRunRequest")
+
+
+-- | 
+data CreateSpeechRequest = CreateSpeechRequest
+  { createSpeechRequestModel :: CreateSpeechRequestModel -- ^ 
+  , createSpeechRequestInput :: Text -- ^ The text to generate audio for. The maximum length is 4096 characters.
+  , createSpeechRequestVoice :: Text -- ^ The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options).
+  , createSpeechRequestResponseUnderscoreformat :: Maybe Text -- ^ The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
+  , createSpeechRequestSpeed :: Maybe Double -- ^ The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateSpeechRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createSpeechRequest")
+instance ToJSON CreateSpeechRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createSpeechRequest")
+
+
+-- | One of the available [TTS models](/docs/models/tts): &#x60;tts-1&#x60; or &#x60;tts-1-hd&#x60; 
+data CreateSpeechRequestModel = CreateSpeechRequestModel Text  deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateSpeechRequestModel where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createSpeechRequestModel")
+instance ToJSON CreateSpeechRequestModel where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createSpeechRequestModel")
+
+
+-- | 
+data CreateThreadAndRunRequest = CreateThreadAndRunRequest
+  { createThreadAndRunRequestAssistantUnderscoreid :: Text -- ^ The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.
+  , createThreadAndRunRequestThread :: Maybe CreateThreadRequest -- ^ 
+  , createThreadAndRunRequestModel :: Maybe Text -- ^ The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
+  , createThreadAndRunRequestInstructions :: Maybe Text -- ^ Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
+  , createThreadAndRunRequestTools :: Maybe [CreateThreadAndRunRequestToolsInner] -- ^ Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
+  , createThreadAndRunRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateThreadAndRunRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createThreadAndRunRequest")
+instance ToJSON CreateThreadAndRunRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createThreadAndRunRequest")
+
+
+-- | 
+data CreateThreadAndRunRequestToolsInner = CreateThreadAndRunRequestToolsInner
+  { createThreadAndRunRequestToolsInnerType :: Text -- ^ The type of tool being defined: `function`
+  , createThreadAndRunRequestToolsInnerFunction :: FunctionObject -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateThreadAndRunRequestToolsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createThreadAndRunRequestToolsInner")
+instance ToJSON CreateThreadAndRunRequestToolsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createThreadAndRunRequestToolsInner")
+
+
+-- | 
+data CreateThreadRequest = CreateThreadRequest
+  { createThreadRequestMessages :: Maybe [CreateMessageRequest] -- ^ A list of [messages](/docs/api-reference/messages) to start the thread with.
+  , createThreadRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateThreadRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createThreadRequest")
+instance ToJSON CreateThreadRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createThreadRequest")
+
+
+-- | 
+data CreateTranscription200Response = CreateTranscription200Response
+  { createTranscription200ResponseText :: Text -- ^ The transcribed text.
+  , createTranscription200ResponseLanguage :: Text -- ^ The language of the input audio.
+  , createTranscription200ResponseDuration :: Text -- ^ The duration of the input audio.
+  , createTranscription200ResponseWords :: Maybe [TranscriptionWord] -- ^ Extracted words and their corresponding timestamps.
+  , createTranscription200ResponseSegments :: Maybe [TranscriptionSegment] -- ^ Segments of the transcribed text and their corresponding details.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranscription200Response where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranscription200Response")
+instance ToJSON CreateTranscription200Response where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranscription200Response")
+
+
+-- | Represents a transcription response returned by model, based on the provided input.
+data CreateTranscriptionResponseJson = CreateTranscriptionResponseJson
+  { createTranscriptionResponseJsonText :: Text -- ^ The transcribed text.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranscriptionResponseJson where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranscriptionResponseJson")
+instance ToJSON CreateTranscriptionResponseJson where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranscriptionResponseJson")
+
+
+-- | Represents a verbose json transcription response returned by model, based on the provided input.
+data CreateTranscriptionResponseVerboseJson = CreateTranscriptionResponseVerboseJson
+  { createTranscriptionResponseVerboseJsonLanguage :: Text -- ^ The language of the input audio.
+  , createTranscriptionResponseVerboseJsonDuration :: Text -- ^ The duration of the input audio.
+  , createTranscriptionResponseVerboseJsonText :: Text -- ^ The transcribed text.
+  , createTranscriptionResponseVerboseJsonWords :: Maybe [TranscriptionWord] -- ^ Extracted words and their corresponding timestamps.
+  , createTranscriptionResponseVerboseJsonSegments :: Maybe [TranscriptionSegment] -- ^ Segments of the transcribed text and their corresponding details.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranscriptionResponseVerboseJson where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranscriptionResponseVerboseJson")
+instance ToJSON CreateTranscriptionResponseVerboseJson where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranscriptionResponseVerboseJson")
+
+
+-- | 
+data CreateTranslation200Response = CreateTranslation200Response
+  { createTranslation200ResponseText :: Text -- ^ The translated text.
+  , createTranslation200ResponseLanguage :: Text -- ^ The language of the output translation (always `english`).
+  , createTranslation200ResponseDuration :: Text -- ^ The duration of the input audio.
+  , createTranslation200ResponseSegments :: Maybe [TranscriptionSegment] -- ^ Segments of the translated text and their corresponding details.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranslation200Response where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranslation200Response")
+instance ToJSON CreateTranslation200Response where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranslation200Response")
+
+
+-- | 
+data CreateTranslationResponseJson = CreateTranslationResponseJson
+  { createTranslationResponseJsonText :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranslationResponseJson where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranslationResponseJson")
+instance ToJSON CreateTranslationResponseJson where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranslationResponseJson")
+
+
+-- | 
+data CreateTranslationResponseVerboseJson = CreateTranslationResponseVerboseJson
+  { createTranslationResponseVerboseJsonLanguage :: Text -- ^ The language of the output translation (always `english`).
+  , createTranslationResponseVerboseJsonDuration :: Text -- ^ The duration of the input audio.
+  , createTranslationResponseVerboseJsonText :: Text -- ^ The translated text.
+  , createTranslationResponseVerboseJsonSegments :: Maybe [TranscriptionSegment] -- ^ Segments of the translated text and their corresponding details.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON CreateTranslationResponseVerboseJson where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "createTranslationResponseVerboseJson")
+instance ToJSON CreateTranslationResponseVerboseJson where
+  toJSON = genericToJSON (removeFieldLabelPrefix "createTranslationResponseVerboseJson")
+
+
+-- | Deletes the association between the assistant and the file, but does not delete the [File](/docs/api-reference/files) object itself.
+data DeleteAssistantFileResponse = DeleteAssistantFileResponse
+  { deleteAssistantFileResponseId :: Text -- ^ 
+  , deleteAssistantFileResponseDeleted :: Bool -- ^ 
+  , deleteAssistantFileResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteAssistantFileResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteAssistantFileResponse")
+instance ToJSON DeleteAssistantFileResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteAssistantFileResponse")
+
+
+-- | 
+data DeleteAssistantResponse = DeleteAssistantResponse
+  { deleteAssistantResponseId :: Text -- ^ 
+  , deleteAssistantResponseDeleted :: Bool -- ^ 
+  , deleteAssistantResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteAssistantResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteAssistantResponse")
+instance ToJSON DeleteAssistantResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteAssistantResponse")
+
+
+-- | 
+data DeleteFileResponse = DeleteFileResponse
+  { deleteFileResponseId :: Text -- ^ 
+  , deleteFileResponseObject :: Text -- ^ 
+  , deleteFileResponseDeleted :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteFileResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteFileResponse")
+instance ToJSON DeleteFileResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteFileResponse")
+
+
+-- | 
+data DeleteMessageResponse = DeleteMessageResponse
+  { deleteMessageResponseId :: Text -- ^ 
+  , deleteMessageResponseDeleted :: Bool -- ^ 
+  , deleteMessageResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteMessageResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteMessageResponse")
+instance ToJSON DeleteMessageResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteMessageResponse")
+
+
+-- | 
+data DeleteModelResponse = DeleteModelResponse
+  { deleteModelResponseId :: Text -- ^ 
+  , deleteModelResponseDeleted :: Bool -- ^ 
+  , deleteModelResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteModelResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteModelResponse")
+instance ToJSON DeleteModelResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteModelResponse")
+
+
+-- | 
+data DeleteThreadResponse = DeleteThreadResponse
+  { deleteThreadResponseId :: Text -- ^ 
+  , deleteThreadResponseDeleted :: Bool -- ^ 
+  , deleteThreadResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON DeleteThreadResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "deleteThreadResponse")
+instance ToJSON DeleteThreadResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "deleteThreadResponse")
+
+
+-- | Represents an embedding vector returned by embedding endpoint. 
+data Embedding = Embedding
+  { embeddingIndex :: Int -- ^ The index of the embedding in the list of embeddings.
+  , embeddingEmbedding :: [Double] -- ^ The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings). 
+  , embeddingObject :: Text -- ^ The object type, which is always \"embedding\".
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON Embedding where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "embedding")
+instance ToJSON Embedding where
+  toJSON = genericToJSON (removeFieldLabelPrefix "embedding")
+
+
+-- | 
+data Error = Error
+  { errorCode :: Text -- ^ 
+  , errorMessage :: Text -- ^ 
+  , errorParam :: Text -- ^ 
+  , errorType :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON Error where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "error")
+instance ToJSON Error where
+  toJSON = genericToJSON (removeFieldLabelPrefix "error")
+
+
+-- | 
+data ErrorResponse = ErrorResponse
+  { errorResponseError :: Error -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ErrorResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "errorResponse")
+instance ToJSON ErrorResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "errorResponse")
+
+
+-- | The &#x60;fine_tuning.job&#x60; object represents a fine-tuning job that has been created through the API. 
+data FineTuningJob = FineTuningJob
+  { fineTuningJobId :: Text -- ^ The object identifier, which can be referenced in the API endpoints.
+  , fineTuningJobCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the fine-tuning job was created.
+  , fineTuningJobError :: FineTuningJobError -- ^ 
+  , fineTuningJobFineUnderscoretunedUnderscoremodel :: Text -- ^ The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
+  , fineTuningJobFinishedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
+  , fineTuningJobHyperparameters :: FineTuningJobHyperparameters -- ^ 
+  , fineTuningJobModel :: Text -- ^ The base model that is being fine-tuned.
+  , fineTuningJobObject :: Text -- ^ The object type, which is always \"fine_tuning.job\".
+  , fineTuningJobOrganizationUnderscoreid :: Text -- ^ The organization that owns the fine-tuning job.
+  , fineTuningJobResultUnderscorefiles :: [Text] -- ^ The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents).
+  , fineTuningJobStatus :: Text -- ^ The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.
+  , fineTuningJobTrainedUnderscoretokens :: Int -- ^ The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
+  , fineTuningJobTrainingUnderscorefile :: Text -- ^ The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents).
+  , fineTuningJobValidationUnderscorefile :: Text -- ^ The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents).
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FineTuningJob where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "fineTuningJob")
+instance ToJSON FineTuningJob where
+  toJSON = genericToJSON (removeFieldLabelPrefix "fineTuningJob")
+
+
+-- | For fine-tuning jobs that have &#x60;failed&#x60;, this will contain more information on the cause of the failure.
+data FineTuningJobError = FineTuningJobError
+  { fineTuningJobErrorCode :: Text -- ^ A machine-readable error code.
+  , fineTuningJobErrorMessage :: Text -- ^ A human-readable error message.
+  , fineTuningJobErrorParam :: Text -- ^ The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FineTuningJobError where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "fineTuningJobError")
+instance ToJSON FineTuningJobError where
+  toJSON = genericToJSON (removeFieldLabelPrefix "fineTuningJobError")
+
+
+-- | Fine-tuning job event object
+data FineTuningJobEvent = FineTuningJobEvent
+  { fineTuningJobEventId :: Text -- ^ 
+  , fineTuningJobEventCreatedUnderscoreat :: Int -- ^ 
+  , fineTuningJobEventLevel :: Text -- ^ 
+  , fineTuningJobEventMessage :: Text -- ^ 
+  , fineTuningJobEventObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FineTuningJobEvent where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "fineTuningJobEvent")
+instance ToJSON FineTuningJobEvent where
+  toJSON = genericToJSON (removeFieldLabelPrefix "fineTuningJobEvent")
+
+
+-- | The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details.
+data FineTuningJobHyperparameters = FineTuningJobHyperparameters
+  { fineTuningJobHyperparametersNUnderscoreepochs :: FineTuningJobHyperparametersNEpochs -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FineTuningJobHyperparameters where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "fineTuningJobHyperparameters")
+instance ToJSON FineTuningJobHyperparameters where
+  toJSON = genericToJSON (removeFieldLabelPrefix "fineTuningJobHyperparameters")
+
+
+-- | The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. \&quot;auto\&quot; decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs.
+data FineTuningJobHyperparametersNEpochs = FineTuningJobHyperparametersNEpochs
+  { 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FineTuningJobHyperparametersNEpochs where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "fineTuningJobHyperparametersNEpochs")
+instance ToJSON FineTuningJobHyperparametersNEpochs where
+  toJSON = genericToJSON (removeFieldLabelPrefix "fineTuningJobHyperparametersNEpochs")
+
+
+-- | 
+data FunctionObject = FunctionObject
+  { functionObjectDescription :: Maybe Text -- ^ A description of what the function does, used by the model to choose when and how to call the function.
+  , functionObjectName :: Text -- ^ The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
+  , functionObjectParameters :: Maybe (Map.Map String Value) -- ^ The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.   Omitting `parameters` defines a function with an empty parameter list.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON FunctionObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "functionObject")
+instance ToJSON FunctionObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "functionObject")
+
+
+-- | Represents the url or the content of an image generated by the OpenAI API.
+data Image = Image
+  { imageB64Underscorejson :: Maybe Text -- ^ The base64-encoded JSON of the generated image, if `response_format` is `b64_json`.
+  , imageUrl :: Maybe Text -- ^ The URL of the generated image, if `response_format` is `url` (default).
+  , imageRevisedUnderscoreprompt :: Maybe Text -- ^ The prompt that was used to generate the image, if there was any revision to the prompt.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON Image where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "image")
+instance ToJSON Image where
+  toJSON = genericToJSON (removeFieldLabelPrefix "image")
+
+
+-- | 
+data ImagesResponse = ImagesResponse
+  { imagesResponseCreated :: Int -- ^ 
+  , imagesResponseData :: [Image] -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ImagesResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "imagesResponse")
+instance ToJSON ImagesResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "imagesResponse")
+
+
+-- | 
+data ListAssistantFilesResponse = ListAssistantFilesResponse
+  { listAssistantFilesResponseObject :: Text -- ^ 
+  , listAssistantFilesResponseData :: [AssistantFileObject] -- ^ 
+  , listAssistantFilesResponseFirstUnderscoreid :: Text -- ^ 
+  , listAssistantFilesResponseLastUnderscoreid :: Text -- ^ 
+  , listAssistantFilesResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListAssistantFilesResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listAssistantFilesResponse")
+instance ToJSON ListAssistantFilesResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listAssistantFilesResponse")
+
+
+-- | 
+data ListAssistantsResponse = ListAssistantsResponse
+  { listAssistantsResponseObject :: Text -- ^ 
+  , listAssistantsResponseData :: [AssistantObject] -- ^ 
+  , listAssistantsResponseFirstUnderscoreid :: Text -- ^ 
+  , listAssistantsResponseLastUnderscoreid :: Text -- ^ 
+  , listAssistantsResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListAssistantsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listAssistantsResponse")
+instance ToJSON ListAssistantsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listAssistantsResponse")
+
+
+-- | 
+data ListFilesResponse = ListFilesResponse
+  { listFilesResponseData :: [OpenAIFile] -- ^ 
+  , listFilesResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListFilesResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listFilesResponse")
+instance ToJSON ListFilesResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listFilesResponse")
+
+
+-- | 
+data ListFineTuningJobEventsResponse = ListFineTuningJobEventsResponse
+  { listFineTuningJobEventsResponseData :: [FineTuningJobEvent] -- ^ 
+  , listFineTuningJobEventsResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListFineTuningJobEventsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listFineTuningJobEventsResponse")
+instance ToJSON ListFineTuningJobEventsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listFineTuningJobEventsResponse")
+
+
+-- | 
+data ListMessageFilesResponse = ListMessageFilesResponse
+  { listMessageFilesResponseObject :: Text -- ^ 
+  , listMessageFilesResponseData :: [MessageFileObject] -- ^ 
+  , listMessageFilesResponseFirstUnderscoreid :: Text -- ^ 
+  , listMessageFilesResponseLastUnderscoreid :: Text -- ^ 
+  , listMessageFilesResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListMessageFilesResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listMessageFilesResponse")
+instance ToJSON ListMessageFilesResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listMessageFilesResponse")
+
+
+-- | 
+data ListMessagesResponse = ListMessagesResponse
+  { listMessagesResponseObject :: Text -- ^ 
+  , listMessagesResponseData :: [MessageObject] -- ^ 
+  , listMessagesResponseFirstUnderscoreid :: Text -- ^ 
+  , listMessagesResponseLastUnderscoreid :: Text -- ^ 
+  , listMessagesResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListMessagesResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listMessagesResponse")
+instance ToJSON ListMessagesResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listMessagesResponse")
+
+
+-- | 
+data ListModelsResponse = ListModelsResponse
+  { listModelsResponseObject :: Text -- ^ 
+  , listModelsResponseData :: [Model] -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListModelsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listModelsResponse")
+instance ToJSON ListModelsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listModelsResponse")
+
+
+-- | 
+data ListPaginatedFineTuningJobsResponse = ListPaginatedFineTuningJobsResponse
+  { listPaginatedFineTuningJobsResponseData :: [FineTuningJob] -- ^ 
+  , listPaginatedFineTuningJobsResponseHasUnderscoremore :: Bool -- ^ 
+  , listPaginatedFineTuningJobsResponseObject :: Text -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListPaginatedFineTuningJobsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listPaginatedFineTuningJobsResponse")
+instance ToJSON ListPaginatedFineTuningJobsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listPaginatedFineTuningJobsResponse")
+
+
+-- | 
+data ListRunStepsResponse = ListRunStepsResponse
+  { listRunStepsResponseObject :: Text -- ^ 
+  , listRunStepsResponseData :: [RunStepObject] -- ^ 
+  , listRunStepsResponseFirstUnderscoreid :: Text -- ^ 
+  , listRunStepsResponseLastUnderscoreid :: Text -- ^ 
+  , listRunStepsResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListRunStepsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listRunStepsResponse")
+instance ToJSON ListRunStepsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listRunStepsResponse")
+
+
+-- | 
+data ListRunsResponse = ListRunsResponse
+  { listRunsResponseObject :: Text -- ^ 
+  , listRunsResponseData :: [RunObject] -- ^ 
+  , listRunsResponseFirstUnderscoreid :: Text -- ^ 
+  , listRunsResponseLastUnderscoreid :: Text -- ^ 
+  , listRunsResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListRunsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listRunsResponse")
+instance ToJSON ListRunsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listRunsResponse")
+
+
+-- | 
+data ListThreadsResponse = ListThreadsResponse
+  { listThreadsResponseObject :: Text -- ^ 
+  , listThreadsResponseData :: [ThreadObject] -- ^ 
+  , listThreadsResponseFirstUnderscoreid :: Text -- ^ 
+  , listThreadsResponseLastUnderscoreid :: Text -- ^ 
+  , listThreadsResponseHasUnderscoremore :: Bool -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ListThreadsResponse where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "listThreadsResponse")
+instance ToJSON ListThreadsResponse where
+  toJSON = genericToJSON (removeFieldLabelPrefix "listThreadsResponse")
+
+
+-- | References an image [File](/docs/api-reference/files) in the content of a message.
+data MessageContentImageFileObject = MessageContentImageFileObject
+  { messageContentImageFileObjectType :: Text -- ^ Always `image_file`.
+  , messageContentImageFileObjectImageUnderscorefile :: MessageContentImageFileObjectImageFile -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentImageFileObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentImageFileObject")
+instance ToJSON MessageContentImageFileObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentImageFileObject")
+
+
+-- | 
+data MessageContentImageFileObjectImageFile = MessageContentImageFileObjectImageFile
+  { messageContentImageFileObjectImageFileFileUnderscoreid :: Text -- ^ The [File](/docs/api-reference/files) ID of the image in the message content.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentImageFileObjectImageFile where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentImageFileObjectImageFile")
+instance ToJSON MessageContentImageFileObjectImageFile where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentImageFileObjectImageFile")
+
+
+-- | A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \&quot;retrieval\&quot; tool to search files.
+data MessageContentTextAnnotationsFileCitationObject = MessageContentTextAnnotationsFileCitationObject
+  { messageContentTextAnnotationsFileCitationObjectType :: Text -- ^ Always `file_citation`.
+  , messageContentTextAnnotationsFileCitationObjectText :: Text -- ^ The text in the message content that needs to be replaced.
+  , messageContentTextAnnotationsFileCitationObjectFileUnderscorecitation :: MessageContentTextAnnotationsFileCitationObjectFileCitation -- ^ 
+  , messageContentTextAnnotationsFileCitationObjectStartUnderscoreindex :: Int -- ^ 
+  , messageContentTextAnnotationsFileCitationObjectEndUnderscoreindex :: Int -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextAnnotationsFileCitationObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFileCitationObject")
+instance ToJSON MessageContentTextAnnotationsFileCitationObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFileCitationObject")
+
+
+-- | 
+data MessageContentTextAnnotationsFileCitationObjectFileCitation = MessageContentTextAnnotationsFileCitationObjectFileCitation
+  { messageContentTextAnnotationsFileCitationObjectFileCitationFileUnderscoreid :: Text -- ^ The ID of the specific File the citation is from.
+  , messageContentTextAnnotationsFileCitationObjectFileCitationQuote :: Text -- ^ The specific quote in the file.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextAnnotationsFileCitationObjectFileCitation where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFileCitationObjectFileCitation")
+instance ToJSON MessageContentTextAnnotationsFileCitationObjectFileCitation where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFileCitationObjectFileCitation")
+
+
+-- | A URL for the file that&#39;s generated when the assistant used the &#x60;code_interpreter&#x60; tool to generate a file.
+data MessageContentTextAnnotationsFilePathObject = MessageContentTextAnnotationsFilePathObject
+  { messageContentTextAnnotationsFilePathObjectType :: Text -- ^ Always `file_path`.
+  , messageContentTextAnnotationsFilePathObjectText :: Text -- ^ The text in the message content that needs to be replaced.
+  , messageContentTextAnnotationsFilePathObjectFileUnderscorepath :: MessageContentTextAnnotationsFilePathObjectFilePath -- ^ 
+  , messageContentTextAnnotationsFilePathObjectStartUnderscoreindex :: Int -- ^ 
+  , messageContentTextAnnotationsFilePathObjectEndUnderscoreindex :: Int -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextAnnotationsFilePathObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFilePathObject")
+instance ToJSON MessageContentTextAnnotationsFilePathObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFilePathObject")
+
+
+-- | 
+data MessageContentTextAnnotationsFilePathObjectFilePath = MessageContentTextAnnotationsFilePathObjectFilePath
+  { messageContentTextAnnotationsFilePathObjectFilePathFileUnderscoreid :: Text -- ^ The ID of the file that was generated.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextAnnotationsFilePathObjectFilePath where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFilePathObjectFilePath")
+instance ToJSON MessageContentTextAnnotationsFilePathObjectFilePath where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextAnnotationsFilePathObjectFilePath")
+
+
+-- | The text content that is part of a message.
+data MessageContentTextObject = MessageContentTextObject
+  { messageContentTextObjectType :: Text -- ^ Always `text`.
+  , messageContentTextObjectText :: MessageContentTextObjectText -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextObject")
+instance ToJSON MessageContentTextObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextObject")
+
+
+-- | 
+data MessageContentTextObjectText = MessageContentTextObjectText
+  { messageContentTextObjectTextValue :: Text -- ^ The data that makes up the text.
+  , messageContentTextObjectTextAnnotations :: [MessageContentTextObjectTextAnnotationsInner] -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextObjectText where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextObjectText")
+instance ToJSON MessageContentTextObjectText where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextObjectText")
+
+
+-- | 
+data MessageContentTextObjectTextAnnotationsInner = MessageContentTextObjectTextAnnotationsInner
+  { messageContentTextObjectTextAnnotationsInnerType :: Text -- ^ Always `file_path`.
+  , messageContentTextObjectTextAnnotationsInnerText :: Text -- ^ The text in the message content that needs to be replaced.
+  , messageContentTextObjectTextAnnotationsInnerFileUnderscorecitation :: MessageContentTextAnnotationsFileCitationObjectFileCitation -- ^ 
+  , messageContentTextObjectTextAnnotationsInnerStartUnderscoreindex :: Int -- ^ 
+  , messageContentTextObjectTextAnnotationsInnerEndUnderscoreindex :: Int -- ^ 
+  , messageContentTextObjectTextAnnotationsInnerFileUnderscorepath :: MessageContentTextAnnotationsFilePathObjectFilePath -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageContentTextObjectTextAnnotationsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageContentTextObjectTextAnnotationsInner")
+instance ToJSON MessageContentTextObjectTextAnnotationsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageContentTextObjectTextAnnotationsInner")
+
+
+-- | A list of files attached to a &#x60;message&#x60;.
+data MessageFileObject = MessageFileObject
+  { messageFileObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , messageFileObjectObject :: Text -- ^ The object type, which is always `thread.message.file`.
+  , messageFileObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the message file was created.
+  , messageFileObjectMessageUnderscoreid :: Text -- ^ The ID of the [message](/docs/api-reference/messages) that the [File](/docs/api-reference/files) is attached to.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageFileObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageFileObject")
+instance ToJSON MessageFileObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageFileObject")
+
+
+-- | Represents a message within a [thread](/docs/api-reference/threads).
+data MessageObject = MessageObject
+  { messageObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , messageObjectObject :: Text -- ^ The object type, which is always `thread.message`.
+  , messageObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the message was created.
+  , messageObjectThreadUnderscoreid :: Text -- ^ The [thread](/docs/api-reference/threads) ID that this message belongs to.
+  , messageObjectRole :: Text -- ^ The entity that produced the message. One of `user` or `assistant`.
+  , messageObjectContent :: [MessageObjectContentInner] -- ^ The content of the message in array of text and/or images.
+  , messageObjectAssistantUnderscoreid :: Text -- ^ If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message.
+  , messageObjectRunUnderscoreid :: Text -- ^ If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message.
+  , messageObjectFileUnderscoreids :: [Text] -- ^ A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message.
+  , messageObjectMetadata :: Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageObject")
+instance ToJSON MessageObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageObject")
+
+
+-- | 
+data MessageObjectContentInner = MessageObjectContentInner
+  { messageObjectContentInnerType :: Text -- ^ Always `text`.
+  , messageObjectContentInnerImageUnderscorefile :: MessageContentImageFileObjectImageFile -- ^ 
+  , messageObjectContentInnerText :: MessageContentTextObjectText -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON MessageObjectContentInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "messageObjectContentInner")
+instance ToJSON MessageObjectContentInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "messageObjectContentInner")
+
+
+-- | Describes an OpenAI model offering that can be used with the API.
+data Model = Model
+  { modelId :: Text -- ^ The model identifier, which can be referenced in the API endpoints.
+  , modelCreated :: Int -- ^ The Unix timestamp (in seconds) when the model was created.
+  , modelObject :: Text -- ^ The object type, which is always \"model\".
+  , modelOwnedUnderscoreby :: Text -- ^ The organization that owns the model.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON Model where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "model")
+instance ToJSON Model where
+  toJSON = genericToJSON (removeFieldLabelPrefix "model")
+
+
+-- | 
+data ModifyAssistantRequest = ModifyAssistantRequest
+  { modifyAssistantRequestModel :: Maybe CreateAssistantRequestModel -- ^ 
+  , modifyAssistantRequestName :: Maybe Text -- ^ The name of the assistant. The maximum length is 256 characters. 
+  , modifyAssistantRequestDescription :: Maybe Text -- ^ The description of the assistant. The maximum length is 512 characters. 
+  , modifyAssistantRequestInstructions :: Maybe Text -- ^ The system instructions that the assistant uses. The maximum length is 32768 characters. 
+  , modifyAssistantRequestTools :: Maybe [AssistantObjectToolsInner] -- ^ A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. 
+  , modifyAssistantRequestFileUnderscoreids :: Maybe [Text] -- ^ A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. 
+  , modifyAssistantRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ModifyAssistantRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "modifyAssistantRequest")
+instance ToJSON ModifyAssistantRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "modifyAssistantRequest")
+
+
+-- | 
+data ModifyMessageRequest = ModifyMessageRequest
+  { modifyMessageRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ModifyMessageRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "modifyMessageRequest")
+instance ToJSON ModifyMessageRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "modifyMessageRequest")
+
+
+-- | 
+data ModifyRunRequest = ModifyRunRequest
+  { modifyRunRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ModifyRunRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "modifyRunRequest")
+instance ToJSON ModifyRunRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "modifyRunRequest")
+
+
+-- | 
+data ModifyThreadRequest = ModifyThreadRequest
+  { modifyThreadRequestMetadata :: Maybe Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ModifyThreadRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "modifyThreadRequest")
+instance ToJSON ModifyThreadRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "modifyThreadRequest")
+
+
+-- | The &#x60;File&#x60; object represents a document that has been uploaded to OpenAI.
+data OpenAIFile = OpenAIFile
+  { openAIFileId :: Text -- ^ The file identifier, which can be referenced in the API endpoints.
+  , openAIFileBytes :: Int -- ^ The size of the file, in bytes.
+  , openAIFileCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the file was created.
+  , openAIFileFilename :: Text -- ^ The name of the file.
+  , openAIFileObject :: Text -- ^ The object type, which is always `file`.
+  , openAIFilePurpose :: Text -- ^ The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`.
+  , openAIFileStatus :: Text -- ^ Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
+  , openAIFileStatusUnderscoredetails :: Maybe Text -- ^ Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON OpenAIFile where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "openAIFile")
+instance ToJSON OpenAIFile where
+  toJSON = genericToJSON (removeFieldLabelPrefix "openAIFile")
+
+
+-- | Usage statistics related to the run. This value will be &#x60;null&#x60; if the run is not in a terminal state (i.e. &#x60;in_progress&#x60;, &#x60;queued&#x60;, etc.).
+data RunCompletionUsage = RunCompletionUsage
+  { runCompletionUsageCompletionUnderscoretokens :: Int -- ^ Number of completion tokens used over the course of the run.
+  , runCompletionUsagePromptUnderscoretokens :: Int -- ^ Number of prompt tokens used over the course of the run.
+  , runCompletionUsageTotalUnderscoretokens :: Int -- ^ Total number of tokens used (prompt + completion).
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunCompletionUsage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runCompletionUsage")
+instance ToJSON RunCompletionUsage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runCompletionUsage")
+
+
+-- | Represents an execution run on a [thread](/docs/api-reference/threads).
+data RunObject = RunObject
+  { runObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , runObjectObject :: Text -- ^ The object type, which is always `thread.run`.
+  , runObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run was created.
+  , runObjectThreadUnderscoreid :: Text -- ^ The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.
+  , runObjectAssistantUnderscoreid :: Text -- ^ The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run.
+  , runObjectStatus :: Text -- ^ The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`.
+  , runObjectRequiredUnderscoreaction :: RunObjectRequiredAction -- ^ 
+  , runObjectLastUnderscoreerror :: RunObjectLastError -- ^ 
+  , runObjectExpiresUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run will expire.
+  , runObjectStartedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run was started.
+  , runObjectCancelledUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run was cancelled.
+  , runObjectFailedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run failed.
+  , runObjectCompletedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run was completed.
+  , runObjectModel :: Text -- ^ The model that the [assistant](/docs/api-reference/assistants) used for this run.
+  , runObjectInstructions :: Text -- ^ The instructions that the [assistant](/docs/api-reference/assistants) used for this run.
+  , runObjectTools :: [AssistantObjectToolsInner] -- ^ The list of tools that the [assistant](/docs/api-reference/assistants) used for this run.
+  , runObjectFileUnderscoreids :: [Text] -- ^ The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run.
+  , runObjectMetadata :: Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  , runObjectUsage :: RunCompletionUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runObject")
+instance ToJSON RunObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runObject")
+
+
+-- | The last error associated with this run. Will be &#x60;null&#x60; if there are no errors.
+data RunObjectLastError = RunObjectLastError
+  { runObjectLastErrorCode :: Text -- ^ One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.
+  , runObjectLastErrorMessage :: Text -- ^ A human-readable description of the error.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunObjectLastError where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runObjectLastError")
+instance ToJSON RunObjectLastError where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runObjectLastError")
+
+
+-- | Details on the action required to continue the run. Will be &#x60;null&#x60; if no action is required.
+data RunObjectRequiredAction = RunObjectRequiredAction
+  { runObjectRequiredActionType :: Text -- ^ For now, this is always `submit_tool_outputs`.
+  , runObjectRequiredActionSubmitUnderscoretoolUnderscoreoutputs :: RunObjectRequiredActionSubmitToolOutputs -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunObjectRequiredAction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runObjectRequiredAction")
+instance ToJSON RunObjectRequiredAction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runObjectRequiredAction")
+
+
+-- | Details on the tool outputs needed for this run to continue.
+data RunObjectRequiredActionSubmitToolOutputs = RunObjectRequiredActionSubmitToolOutputs
+  { runObjectRequiredActionSubmitToolOutputsToolUnderscorecalls :: [RunToolCallObject] -- ^ A list of the relevant tool calls.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunObjectRequiredActionSubmitToolOutputs where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runObjectRequiredActionSubmitToolOutputs")
+instance ToJSON RunObjectRequiredActionSubmitToolOutputs where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runObjectRequiredActionSubmitToolOutputs")
+
+
+-- | Usage statistics related to the run step. This value will be &#x60;null&#x60; while the run step&#39;s status is &#x60;in_progress&#x60;.
+data RunStepCompletionUsage = RunStepCompletionUsage
+  { runStepCompletionUsageCompletionUnderscoretokens :: Int -- ^ Number of completion tokens used over the course of the run step.
+  , runStepCompletionUsagePromptUnderscoretokens :: Int -- ^ Number of prompt tokens used over the course of the run step.
+  , runStepCompletionUsageTotalUnderscoretokens :: Int -- ^ Total number of tokens used (prompt + completion).
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepCompletionUsage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepCompletionUsage")
+instance ToJSON RunStepCompletionUsage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepCompletionUsage")
+
+
+-- | Details of the message creation by the run step.
+data RunStepDetailsMessageCreationObject = RunStepDetailsMessageCreationObject
+  { runStepDetailsMessageCreationObjectType :: Text -- ^ Always `message_creation`.
+  , runStepDetailsMessageCreationObjectMessageUnderscorecreation :: RunStepDetailsMessageCreationObjectMessageCreation -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsMessageCreationObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsMessageCreationObject")
+instance ToJSON RunStepDetailsMessageCreationObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsMessageCreationObject")
+
+
+-- | 
+data RunStepDetailsMessageCreationObjectMessageCreation = RunStepDetailsMessageCreationObjectMessageCreation
+  { runStepDetailsMessageCreationObjectMessageCreationMessageUnderscoreid :: Text -- ^ The ID of the message that was created by this run step.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsMessageCreationObjectMessageCreation where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsMessageCreationObjectMessageCreation")
+instance ToJSON RunStepDetailsMessageCreationObjectMessageCreation where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsMessageCreationObjectMessageCreation")
+
+
+-- | Details of the Code Interpreter tool call the run step was involved in.
+data RunStepDetailsToolCallsCodeObject = RunStepDetailsToolCallsCodeObject
+  { runStepDetailsToolCallsCodeObjectId :: Text -- ^ The ID of the tool call.
+  , runStepDetailsToolCallsCodeObjectType :: Text -- ^ The type of tool call. This is always going to be `code_interpreter` for this type of tool call.
+  , runStepDetailsToolCallsCodeObjectCodeUnderscoreinterpreter :: RunStepDetailsToolCallsCodeObjectCodeInterpreter -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObject")
+instance ToJSON RunStepDetailsToolCallsCodeObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObject")
+
+
+-- | The Code Interpreter tool call definition.
+data RunStepDetailsToolCallsCodeObjectCodeInterpreter = RunStepDetailsToolCallsCodeObjectCodeInterpreter
+  { runStepDetailsToolCallsCodeObjectCodeInterpreterInput :: Text -- ^ The input to the Code Interpreter tool call.
+  , runStepDetailsToolCallsCodeObjectCodeInterpreterOutputs :: [RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner] -- ^ The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeObjectCodeInterpreter where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObjectCodeInterpreter")
+instance ToJSON RunStepDetailsToolCallsCodeObjectCodeInterpreter where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObjectCodeInterpreter")
+
+
+-- | 
+data RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner = RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner
+  { runStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInnerType :: Text -- ^ Always `image`.
+  , runStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInnerLogs :: Text -- ^ The text output from the Code Interpreter tool call.
+  , runStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInnerImage :: RunStepDetailsToolCallsCodeOutputImageObjectImage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner")
+instance ToJSON RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner")
+
+
+-- | 
+data RunStepDetailsToolCallsCodeOutputImageObject = RunStepDetailsToolCallsCodeOutputImageObject
+  { runStepDetailsToolCallsCodeOutputImageObjectType :: Text -- ^ Always `image`.
+  , runStepDetailsToolCallsCodeOutputImageObjectImage :: RunStepDetailsToolCallsCodeOutputImageObjectImage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeOutputImageObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputImageObject")
+instance ToJSON RunStepDetailsToolCallsCodeOutputImageObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputImageObject")
+
+
+-- | 
+data RunStepDetailsToolCallsCodeOutputImageObjectImage = RunStepDetailsToolCallsCodeOutputImageObjectImage
+  { runStepDetailsToolCallsCodeOutputImageObjectImageFileUnderscoreid :: Text -- ^ The [file](/docs/api-reference/files) ID of the image.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeOutputImageObjectImage where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputImageObjectImage")
+instance ToJSON RunStepDetailsToolCallsCodeOutputImageObjectImage where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputImageObjectImage")
+
+
+-- | Text output from the Code Interpreter tool call as part of a run step.
+data RunStepDetailsToolCallsCodeOutputLogsObject = RunStepDetailsToolCallsCodeOutputLogsObject
+  { runStepDetailsToolCallsCodeOutputLogsObjectType :: Text -- ^ Always `logs`.
+  , runStepDetailsToolCallsCodeOutputLogsObjectLogs :: Text -- ^ The text output from the Code Interpreter tool call.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsCodeOutputLogsObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputLogsObject")
+instance ToJSON RunStepDetailsToolCallsCodeOutputLogsObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsCodeOutputLogsObject")
+
+
+-- | 
+data RunStepDetailsToolCallsFunctionObject = RunStepDetailsToolCallsFunctionObject
+  { runStepDetailsToolCallsFunctionObjectId :: Text -- ^ The ID of the tool call object.
+  , runStepDetailsToolCallsFunctionObjectType :: Text -- ^ The type of tool call. This is always going to be `function` for this type of tool call.
+  , runStepDetailsToolCallsFunctionObjectFunction :: RunStepDetailsToolCallsFunctionObjectFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsFunctionObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsFunctionObject")
+instance ToJSON RunStepDetailsToolCallsFunctionObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsFunctionObject")
+
+
+-- | The definition of the function that was called.
+data RunStepDetailsToolCallsFunctionObjectFunction = RunStepDetailsToolCallsFunctionObjectFunction
+  { runStepDetailsToolCallsFunctionObjectFunctionName :: Text -- ^ The name of the function.
+  , runStepDetailsToolCallsFunctionObjectFunctionArguments :: Text -- ^ The arguments passed to the function.
+  , runStepDetailsToolCallsFunctionObjectFunctionOutput :: Text -- ^ The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsFunctionObjectFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsFunctionObjectFunction")
+instance ToJSON RunStepDetailsToolCallsFunctionObjectFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsFunctionObjectFunction")
+
+
+-- | Details of the tool call.
+data RunStepDetailsToolCallsObject = RunStepDetailsToolCallsObject
+  { runStepDetailsToolCallsObjectType :: Text -- ^ Always `tool_calls`.
+  , runStepDetailsToolCallsObjectToolUnderscorecalls :: [RunStepDetailsToolCallsObjectToolCallsInner] -- ^ An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsObject")
+instance ToJSON RunStepDetailsToolCallsObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsObject")
+
+
+-- | 
+data RunStepDetailsToolCallsObjectToolCallsInner = RunStepDetailsToolCallsObjectToolCallsInner
+  { runStepDetailsToolCallsObjectToolCallsInnerId :: Text -- ^ The ID of the tool call object.
+  , runStepDetailsToolCallsObjectToolCallsInnerType :: Text -- ^ The type of tool call. This is always going to be `function` for this type of tool call.
+  , runStepDetailsToolCallsObjectToolCallsInnerCodeUnderscoreinterpreter :: RunStepDetailsToolCallsCodeObjectCodeInterpreter -- ^ 
+  , runStepDetailsToolCallsObjectToolCallsInnerRetrieval :: Value -- ^ For now, this is always going to be an empty object.
+  , runStepDetailsToolCallsObjectToolCallsInnerFunction :: RunStepDetailsToolCallsFunctionObjectFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsObjectToolCallsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsObjectToolCallsInner")
+instance ToJSON RunStepDetailsToolCallsObjectToolCallsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsObjectToolCallsInner")
+
+
+-- | 
+data RunStepDetailsToolCallsRetrievalObject = RunStepDetailsToolCallsRetrievalObject
+  { runStepDetailsToolCallsRetrievalObjectId :: Text -- ^ The ID of the tool call object.
+  , runStepDetailsToolCallsRetrievalObjectType :: Text -- ^ The type of tool call. This is always going to be `retrieval` for this type of tool call.
+  , runStepDetailsToolCallsRetrievalObjectRetrieval :: Value -- ^ For now, this is always going to be an empty object.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepDetailsToolCallsRetrievalObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepDetailsToolCallsRetrievalObject")
+instance ToJSON RunStepDetailsToolCallsRetrievalObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepDetailsToolCallsRetrievalObject")
+
+
+-- | Represents a step in execution of a run. 
+data RunStepObject = RunStepObject
+  { runStepObjectId :: Text -- ^ The identifier of the run step, which can be referenced in API endpoints.
+  , runStepObjectObject :: Text -- ^ The object type, which is always `thread.run.step`.
+  , runStepObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run step was created.
+  , runStepObjectAssistantUnderscoreid :: Text -- ^ The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.
+  , runStepObjectThreadUnderscoreid :: Text -- ^ The ID of the [thread](/docs/api-reference/threads) that was run.
+  , runStepObjectRunUnderscoreid :: Text -- ^ The ID of the [run](/docs/api-reference/runs) that this run step is a part of.
+  , runStepObjectType :: Text -- ^ The type of run step, which can be either `message_creation` or `tool_calls`.
+  , runStepObjectStatus :: Text -- ^ The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.
+  , runStepObjectStepUnderscoredetails :: RunStepObjectStepDetails -- ^ 
+  , runStepObjectLastUnderscoreerror :: RunStepObjectLastError -- ^ 
+  , runStepObjectExpiredUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
+  , runStepObjectCancelledUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run step was cancelled.
+  , runStepObjectFailedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run step failed.
+  , runStepObjectCompletedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the run step completed.
+  , runStepObjectMetadata :: Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  , runStepObjectUsage :: RunStepCompletionUsage -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepObject")
+instance ToJSON RunStepObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepObject")
+
+
+-- | The last error associated with this run step. Will be &#x60;null&#x60; if there are no errors.
+data RunStepObjectLastError = RunStepObjectLastError
+  { runStepObjectLastErrorCode :: Text -- ^ One of `server_error` or `rate_limit_exceeded`.
+  , runStepObjectLastErrorMessage :: Text -- ^ A human-readable description of the error.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepObjectLastError where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepObjectLastError")
+instance ToJSON RunStepObjectLastError where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepObjectLastError")
+
+
+-- | The details of the run step.
+data RunStepObjectStepDetails = RunStepObjectStepDetails
+  { runStepObjectStepDetailsType :: Text -- ^ Always `tool_calls`.
+  , runStepObjectStepDetailsMessageUnderscorecreation :: RunStepDetailsMessageCreationObjectMessageCreation -- ^ 
+  , runStepObjectStepDetailsToolUnderscorecalls :: [RunStepDetailsToolCallsObjectToolCallsInner] -- ^ An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunStepObjectStepDetails where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runStepObjectStepDetails")
+instance ToJSON RunStepObjectStepDetails where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runStepObjectStepDetails")
+
+
+-- | Tool call objects
+data RunToolCallObject = RunToolCallObject
+  { runToolCallObjectId :: Text -- ^ The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint.
+  , runToolCallObjectType :: Text -- ^ The type of tool call the output is required for. For now, this is always `function`.
+  , runToolCallObjectFunction :: RunToolCallObjectFunction -- ^ 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunToolCallObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runToolCallObject")
+instance ToJSON RunToolCallObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runToolCallObject")
+
+
+-- | The function definition.
+data RunToolCallObjectFunction = RunToolCallObjectFunction
+  { runToolCallObjectFunctionName :: Text -- ^ The name of the function.
+  , runToolCallObjectFunctionArguments :: Text -- ^ The arguments that the model expects you to pass to the function.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON RunToolCallObjectFunction where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "runToolCallObjectFunction")
+instance ToJSON RunToolCallObjectFunction where
+  toJSON = genericToJSON (removeFieldLabelPrefix "runToolCallObjectFunction")
+
+
+-- | 
+data SubmitToolOutputsRunRequest = SubmitToolOutputsRunRequest
+  { submitToolOutputsRunRequestToolUnderscoreoutputs :: [SubmitToolOutputsRunRequestToolOutputsInner] -- ^ A list of tools for which the outputs are being submitted.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON SubmitToolOutputsRunRequest where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "submitToolOutputsRunRequest")
+instance ToJSON SubmitToolOutputsRunRequest where
+  toJSON = genericToJSON (removeFieldLabelPrefix "submitToolOutputsRunRequest")
+
+
+-- | 
+data SubmitToolOutputsRunRequestToolOutputsInner = SubmitToolOutputsRunRequestToolOutputsInner
+  { submitToolOutputsRunRequestToolOutputsInnerToolUnderscorecallUnderscoreid :: Maybe Text -- ^ The ID of the tool call in the `required_action` object within the run object the output is being submitted for.
+  , submitToolOutputsRunRequestToolOutputsInnerOutput :: Maybe Text -- ^ The output of the tool call to be submitted to continue the run.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON SubmitToolOutputsRunRequestToolOutputsInner where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "submitToolOutputsRunRequestToolOutputsInner")
+instance ToJSON SubmitToolOutputsRunRequestToolOutputsInner where
+  toJSON = genericToJSON (removeFieldLabelPrefix "submitToolOutputsRunRequestToolOutputsInner")
+
+
+-- | Represents a thread that contains [messages](/docs/api-reference/messages).
+data ThreadObject = ThreadObject
+  { threadObjectId :: Text -- ^ The identifier, which can be referenced in API endpoints.
+  , threadObjectObject :: Text -- ^ The object type, which is always `thread`.
+  , threadObjectCreatedUnderscoreat :: Int -- ^ The Unix timestamp (in seconds) for when the thread was created.
+  , threadObjectMetadata :: Value -- ^ Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. 
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON ThreadObject where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "threadObject")
+instance ToJSON ThreadObject where
+  toJSON = genericToJSON (removeFieldLabelPrefix "threadObject")
+
+
+-- | 
+data TranscriptionSegment = TranscriptionSegment
+  { transcriptionSegmentId :: Int -- ^ Unique identifier of the segment.
+  , transcriptionSegmentSeek :: Int -- ^ Seek offset of the segment.
+  , transcriptionSegmentStart :: Float -- ^ Start time of the segment in seconds.
+  , transcriptionSegmentEnd :: Float -- ^ End time of the segment in seconds.
+  , transcriptionSegmentText :: Text -- ^ Text content of the segment.
+  , transcriptionSegmentTokens :: [Int] -- ^ Array of token IDs for the text content.
+  , transcriptionSegmentTemperature :: Float -- ^ Temperature parameter used for generating the segment.
+  , transcriptionSegmentAvgUnderscorelogprob :: Float -- ^ Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
+  , transcriptionSegmentCompressionUnderscoreratio :: Float -- ^ Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
+  , transcriptionSegmentNoUnderscorespeechUnderscoreprob :: Float -- ^ Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON TranscriptionSegment where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "transcriptionSegment")
+instance ToJSON TranscriptionSegment where
+  toJSON = genericToJSON (removeFieldLabelPrefix "transcriptionSegment")
+
+
+-- | 
+data TranscriptionWord = TranscriptionWord
+  { transcriptionWordWord :: Text -- ^ The text content of the word.
+  , transcriptionWordStart :: Float -- ^ Start time of the word in seconds.
+  , transcriptionWordEnd :: Float -- ^ End time of the word in seconds.
+  } deriving (Show, Eq, Ord, Generic, Data)
+
+instance FromJSON TranscriptionWord where
+  parseJSON = genericParseJSON (removeFieldLabelPrefix "transcriptionWord")
+instance ToJSON TranscriptionWord where
+  toJSON = genericToJSON (removeFieldLabelPrefix "transcriptionWord")
+
+
+uncapitalize :: String -> String
+uncapitalize (first:rest) = Char.toLower first : rest
+uncapitalize [] = []
+
+-- | Remove a field label prefix during JSON parsing.
+--   Also perform any replacements for special characters.
+removeFieldLabelPrefix :: String -> Options
+removeFieldLabelPrefix prefix =
+  defaultOptions
+    { omitNothingFields  = True
+    , fieldLabelModifier = uncapitalize . fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars
+    }
+  where
+    replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
+    specialChars =
+      [ ("$", "Dollar")
+      , ("^", "Caret")
+      , ("|", "Pipe")
+      , ("=", "Equal")
+      , ("*", "Star")
+      , ("-", "Dash")
+      , ("&", "Ampersand")
+      , ("%", "Percent")
+      , ("#", "Hash")
+      , ("@", "At")
+      , ("!", "Exclamation")
+      , ("+", "Plus")
+      , (":", "Colon")
+      , (";", "Semicolon")
+      , (">", "GreaterThan")
+      , ("<", "LessThan")
+      , (".", "Period")
+      , ("_", "Underscore")
+      , ("?", "Question_Mark")
+      , (",", "Comma")
+      , ("'", "Quote")
+      , ("/", "Slash")
+      , ("(", "Left_Parenthesis")
+      , (")", "Right_Parenthesis")
+      , ("{", "Left_Curly_Bracket")
+      , ("}", "Right_Curly_Bracket")
+      , ("[", "Left_Square_Bracket")
+      , ("]", "Right_Square_Bracket")
+      , ("~", "Tilde")
+      , ("`", "Backtick")
+      , ("<=", "Less_Than_Or_Equal_To")
+      , (">=", "Greater_Than_Or_Equal_To")
+      , ("!=", "Not_Equal")
+      , ("<>", "Not_Equal")
+      , ("~=", "Tilde_Equal")
+      , ("\\", "Back_Slash")
+      , ("\"", "Double_Quote")
+      ]
+    mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
+    replacer = T.replace
diff --git a/openai-servant-gen.cabal b/openai-servant-gen.cabal
new file mode 100644
--- /dev/null
+++ b/openai-servant-gen.cabal
@@ -0,0 +1,84 @@
+cabal-version:       3.0
+name:                openai-servant-gen
+version:             0.1.0.0
+synopsis:            Auto-generated API bindings for openai
+description:         This repository provides openai APIs of haskell via openapi-generator. It's just generating. It's intended to provide latest APIs.
+homepage:            https://github.com/junjihashimoto/intelli-monad
+author:              Junji Hashimoto
+maintainer:          junji.hashimoto@gmail.com
+copyright:           2023 - Junji Hashimoto
+category:            Web
+build-type:          Simple
+license:             MIT
+license-file:        LICENSE
+extra-doc-files:     CHANGELOG.md
+                     
+
+library
+  hs-source-dirs:      lib
+  exposed-modules:     OpenAI.API
+                     , OpenAI.Types
+  ghc-options:         -Wall
+  build-depends:       base ==4.*
+                     , aeson >= 2.1 && < 2.3
+                     , containers >= 0.6.7 && < 0.7
+                     , bytestring >= 0.11.5 && < 0.12
+                     , mtl >= 2.3.1 && < 2.4
+                     , transformers >= 0.6.1 && < 0.7
+                     , exceptions >= 0.10.7 && < 0.11
+                     , text >= 2.0.2 && < 2.1
+                     , network-uri >= 2.6.4 && < 2.7
+                     , vector >= 0.13.1 && < 0.14
+                     , time >= 1.12.2 && < 1.13
+                     , http-api-data >= 0.5 && < 0.7
+                     , http-types >= 0.12.4 && < 0.13
+                     , http-client >= 0.7.16 && < 0.8
+                     , http-client-tls >= 0.3.6 && < 0.4
+                     , http-media >= 0.8.1 && < 0.9
+                     , servant >= 0.20.1 && < 0.21
+                     , servant-client >= 0.20 && < 0.21
+                     , servant-client-core >= 0.20 && < 0.21
+                     , servant-server >= 0.20 && < 0.21
+                     , wai >= 3.2.4 && < 3.3
+                     , wai-extra >= 3.1.14 && < 3.2
+                     , warp >= 3.3.31 && < 3.4
+                     , swagger2 >= 2.8.8 && < 2.9
+                     , uuid >= 1.3.15 && < 1.4
+  default-language:    Haskell2010
+
+test-suite openai-servant-gen-test
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test
+  main-is:             Spec.hs
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
+  build-depends:       base
+                     , openai-servant-gen
+                     , hspec
+                     , hspec-wai
+                     , http-types
+                     , http-client
+                     , http-client-tls
+                     , wai
+                     , warp
+                     , aeson
+                     , text
+                     , containers
+                     , exceptions
+                     , network-uri
+                     , servant
+                     , http-api-data
+                     , servant
+                     , servant-client
+                     , servant-client-core
+                     , servant-server
+                     , servant
+                     , wai
+                     , warp
+                     , transformers
+                     , mtl
+                     , time
+                     , swagger2
+                     , uuid
+                     , bytestring
+                     , wai-extra
+  default-language:    Haskell2010
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,159 @@
+-- Test OpenAI.API and OpenAI.Types modules
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
+
+module Main where
+
+import Test.Hspec
+import OpenAI.API
+import OpenAI.Types
+--import Data.Aeson.Decoding
+import Data.Aeson
+import Data.Maybe (fromMaybe)
+import Data.Function ((&))
+import Data.List (stripPrefix)
+import qualified Data.Char as Char
+import qualified Data.Text as T
+
+uncapitalize :: String -> String
+uncapitalize (first:rest) = Char.toLower first : rest
+uncapitalize [] = []
+
+removeFieldLabelPrefix :: Bool -> String -> Options
+removeFieldLabelPrefix forParsing prefix =
+  defaultOptions
+    { omitNothingFields  = True
+    , fieldLabelModifier = uncapitalize . fromMaybe (error ("did not find prefix " ++ prefix)) . stripPrefix prefix . replaceSpecialChars
+    }
+  where
+    replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
+    specialChars =
+      [ ("$", "'Dollar")
+      , ("^", "'Caret")
+      , ("|", "'Pipe")
+      , ("=", "'Equal")
+      , ("*", "'Star")
+      , ("-", "'Dash")
+      , ("&", "'Ampersand")
+      , ("%", "'Percent")
+      , ("#", "'Hash")
+      , ("@", "'At")
+      , ("!", "'Exclamation")
+      , ("+", "'Plus")
+      , (":", "'Colon")
+      , (";", "'Semicolon")
+      , (">", "'GreaterThan")
+      , ("<", "'LessThan")
+      , (".", "'Period")
+      , ("_", "Underscore")
+      , ("?", "'Question_Mark")
+      , (",", "'Comma")
+      , ("'", "'Quote")
+      , ("/", "'Slash")
+      , ("(", "'Left_Parenthesis")
+      , (")", "'Right_Parenthesis")
+      , ("{", "'Left_Curly_Bracket")
+      , ("}", "'Right_Curly_Bracket")
+      , ("[", "'Left_Square_Bracket")
+      , ("]", "'Right_Square_Bracket")
+      , ("~", "'Tilde")
+      , ("`", "'Backtick")
+      , ("<=", "'Less_Than_Or_Equal_To")
+      , (">=", "'Greater_Than_Or_Equal_To")
+      , ("!=", "'Not_Equal")
+      , ("<>", "'Not_Equal")
+      , ("~=", "'Tilde_Equal")
+      , ("\\", "'Back_Slash")
+      , ("\"", "'Double_Quote")
+      ]
+    mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
+    replacer =
+      if forParsing
+        then flip T.replace
+        else T.replace
+
+
+main :: IO ()
+main = hspec $ do
+  describe "OpenAI API" $ do
+    it "Encode labels of CompletionUsage" $ do
+        let options = removeFieldLabelPrefix False "completionUsage"
+            replace = fieldLabelModifier options
+        replace "completionUsagePromptUnderscoretokens" `shouldBe` "prompt_tokens"
+    it "Decode labels of CompletionUsage" $ do
+        let options = removeFieldLabelPrefix False "completionUsage"
+            replace = fieldLabelModifier options
+        replace "completionUsagePromptUnderscoretokens" `shouldBe` "prompt_tokens"
+    it "Encode CompletionUsage" $ do
+        let usage = CompletionUsage 8 9 17
+        encode usage `shouldBe` "{\"completion_tokens\":8,\"prompt_tokens\":9,\"total_tokens\":17}"
+    it "Decode CompletionUsage" $ do
+        let jsonData = "{\n  \"prompt_tokens\": 9,\n  \"completion_tokens\": 8,\n  \"total_tokens\": 17\n}"
+        let response = eitherDecode jsonData :: Either String CompletionUsage
+        response `shouldBe` (Right $ CompletionUsage 8 9 17)
+    it "Encode Request" $ do
+        let jsonData = "{\"messages\":[{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"gpt-3.5-turbo\",\"seed\":0}"
+            request = eitherDecode jsonData :: Either String CreateChatCompletionRequest
+        request `shouldBe` Right (CreateChatCompletionRequest
+                                    { createChatCompletionRequestMessages = [
+                                        ChatCompletionRequestMessage
+                                        { chatCompletionRequestMessageContent = Just $ ChatCompletionRequestMessageContentText "Hello"
+                                        -- 'User' is not one of ['system', 'assistant', 'user', 'function']
+                                        , chatCompletionRequestMessageRole = "user"
+                                        , chatCompletionRequestMessageName = Nothing
+                                        , chatCompletionRequestMessageToolUnderscorecalls = Nothing
+                                        , chatCompletionRequestMessageFunctionUnderscorecall = Nothing
+                                        , chatCompletionRequestMessageToolUnderscorecallUnderscoreid = Nothing
+                                        }
+                                        ]
+                                    , createChatCompletionRequestModel = CreateChatCompletionRequestModel "gpt-3.5-turbo"
+                                    , createChatCompletionRequestFrequencyUnderscorepenalty = Nothing
+                                    , createChatCompletionRequestLogitUnderscorebias = Nothing
+                                    , createChatCompletionRequestLogprobs = Nothing
+                                    , createChatCompletionRequestTopUnderscorelogprobs  = Nothing
+                                    , createChatCompletionRequestMaxUnderscoretokens  = Nothing
+                                    , createChatCompletionRequestN  = Nothing
+                                    , createChatCompletionRequestPresenceUnderscorepenalty  = Nothing
+                                    , createChatCompletionRequestResponseUnderscoreformat  = Nothing
+                                    , createChatCompletionRequestSeed = Just 0
+                                    , createChatCompletionRequestStop = Nothing
+                                    , createChatCompletionRequestStream = Nothing
+                                    , createChatCompletionRequestTemperature = Nothing
+                                    , createChatCompletionRequestTopUnderscorep = Nothing
+                                    , createChatCompletionRequestTools = Nothing
+                                    , createChatCompletionRequestToolUnderscorechoice = Nothing
+                                    , createChatCompletionRequestUser = Nothing
+                                    , createChatCompletionRequestFunctionUnderscorecall = Nothing
+                                    , createChatCompletionRequestFunctions = Nothing
+                                    } )
+    it "Load and save response types" $ do
+        let jsonData = "{\n  \"id\": \"chatcmpl-8zKzKZVra3d7t082fFoB8ZAFxLSWf\",\n  \"object\": \"chat.completion\",\n  \"created\": 1709629378,\n  \"model\": \"gpt-3.5-turbo-0125\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"Hello! How can I assist you today?\"\n      },\n      \"logprobs\": null,\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 8,\n    \"completion_tokens\": 9,\n    \"total_tokens\": 17\n  },\n  \"system_fingerprint\": \"fp_b9d4cef803\"\n}\n"
+        let response = eitherDecode jsonData :: Either String CreateChatCompletionResponse
+        response `shouldBe` (Right (
+            CreateChatCompletionResponse
+            { createChatCompletionResponseId = "chatcmpl-8zKzKZVra3d7t082fFoB8ZAFxLSWf"
+            , createChatCompletionResponseObject = "chat.completion"
+            , createChatCompletionResponseCreated = 1709629378
+            , createChatCompletionResponseModel = "gpt-3.5-turbo-0125"
+            , createChatCompletionResponseChoices = [
+                CreateChatCompletionResponseChoicesInner
+                { createChatCompletionResponseChoicesInnerIndex = 0
+                , createChatCompletionResponseChoicesInnerMessage = ChatCompletionResponseMessage
+                    { chatCompletionResponseMessageRole = "assistant"
+                    , chatCompletionResponseMessageContent = Just "Hello! How can I assist you today?"
+                    , chatCompletionResponseMessageToolUnderscorecalls = Nothing
+                    , chatCompletionResponseMessageFunctionUnderscorecall = Nothing
+                    }
+                , createChatCompletionResponseChoicesInnerLogprobs = Nothing
+                , createChatCompletionResponseChoicesInnerFinishUnderscorereason = "stop"
+                }
+                ]
+            , createChatCompletionResponseUsage = Just $ CompletionUsage
+                { completionUsagePromptUnderscoretokens = 8
+                , completionUsageCompletionUnderscoretokens = 9
+                , completionUsageTotalUnderscoretokens = 17
+                }
+            , createChatCompletionResponseSystemUnderscorefingerprint = Just "fp_b9d4cef803"
+            }
+            ))
