> ## Documentation Index
> Fetch the complete documentation index at: https://pulze.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Space And Models

> Update an Space's configuration.



## OpenAPI

````yaml put /v1/apps/update
openapi: 3.1.0
info:
  title: Pulze.ai API
  version: 0.1.0
servers: []
security: []
paths:
  /v1/apps/update:
    put:
      tags:
        - apps
      summary: Update Space And Models
      description: Update an Space's configuration.
      operationId: update_app_and_models_v1_apps_update_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppUpdate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppSettings'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    AppUpdate:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        sandbox_of:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Sandbox Of
          description: The app this sandbox relates to
        use_parent_custom_data:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Use Parent Custom Data
        benchmark_model_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Benchmark Model Id
          description: Used to update the benchmark model
        name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        app_logo:
          anyOf:
            - type: string
            - type: 'null'
          title: App Logo
        weights:
          anyOf:
            - $ref: '#/components/schemas/LLMModelWeights'
            - type: 'null'
        policies:
          anyOf:
            - $ref: '#/components/schemas/LLMModelPolicies'
            - type: 'null'
        has_failover_chain:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Has Failover Chain
        settings:
          anyOf:
            - $ref: '#/components/schemas/LLMModelSettings'
            - type: 'null'
      type: object
      required:
        - id
      title: AppUpdate
    AppSettings:
      properties:
        main:
          $ref: '#/components/schemas/AppSettingsData'
        sandbox:
          anyOf:
            - $ref: '#/components/schemas/AppSettingsData'
            - type: 'null'
        sandbox_status:
          anyOf:
            - type: string
              enum:
                - outdated
              const: outdated
            - type: 'null'
          title: Sandbox Status
      type: object
      required:
        - main
        - sandbox
        - sandbox_status
      title: AppSettings
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LLMModelWeights:
      properties:
        cost:
          type: number
          title: Cost
          description: >-
            Prioritizes cost when selecting the most optimized models for your
            use case.
          default: 0
        latency:
          type: number
          title: Latency
          description: >-
            Prioritizes latency and reduces the time delay between submitting a
            request and receiving the response.
          default: 0
        quality:
          type: number
          title: Quality
          description: Prioritizes the quality and readability of the generated responses.
          default: 1
      type: object
      title: LLMModelWeights
    LLMModelPolicies:
      properties:
        privacy_level:
          type: integer
          enum:
            - 1
            - 2
            - 3
          title: Privacy Level
          description: |2-

                    The level of privacy for a given request
                    0 = (UNSUPPORTED -- public logs)
                    1 = Log request, response and all of its metadata (Normal mode)
                    2 = Do not log neither the request prompt nor the response text. Logs are still visible, and all of the request metadata accessible. Retrievable as a log. (TBD)
                    3 = Do not log at all. Internally, a minimal representation may be stored for billing: model name, tokens used, which app it belongs to, and timestamp. Not retrievable as a log. (TBD)
                    
          default: 1
        max_cost:
          type: number
          minimum: 0.0001
          title: Max Cost
          description: >-
            The maximum cost allowed for a request. Only works with compounded
            requests that require multiple LLM calls. If the value is reached,
            it will exit with an exception.
          default: 0.02
        max_switch_model_retries:
          type: integer
          maximum: 5
          minimum: 0
          title: Max Switch Model Retries
          description: >-
            If an LLM call fails, _how many other models_ should Pulze try,
            chosen by quality descending? It will be a maximum of N+1 models
            (original + N other models)
          default: 1
        max_same_model_retries:
          type: integer
          maximum: 3
          minimum: 0
          title: Max Same Model Retries
          description: >-
            If an LLM call fails, how many times should Pulze _retry the call to
            the same LLM_? There will be a maximum of N+1 calls (original + N
            retries)
          default: 1
        optimize_internal_requests:
          type: integer
          enum:
            - 0
            - 1
          title: Optimize Internal Requests
          description: >-
            Optimize the internal / intermediate LLM requests, for a big gain in
            speed and cost savings, at the cost of a potential, and very slight,
            penalty on quality. The final request ("SYNTHESIZE") is always
            performed using your original settings.
          default: 0
        prompt_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Prompt Id
          description: Prompt ID that we will use for requests
      type: object
      title: LLMModelPolicies
    LLMModelSettings:
      properties:
        assistant_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assistant Id
        assistant_version_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assistant Version Id
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
        max_tokens:
          type: integer
          title: Max Tokens
          default: 4096
        temperature:
          type: number
          maximum: 1
          minimum: 0
          title: Temperature
          default: 0.7
      type: object
      title: LLMModelSettings
    AppSettingsData:
      properties:
        app:
          $ref: '#/components/schemas/App'
        active_models:
          type: integer
          title: Active Models
        base_model_settings:
          items:
            $ref: '#/components/schemas/PulzeModelActiveForApp'
          type: array
          title: Base Model Settings
        custom_model_settings:
          items:
            $ref: '#/components/schemas/PulzeModelActiveForApp'
          type: array
          title: Custom Model Settings
        failover_models:
          items:
            $ref: '#/components/schemas/ModelData'
          type: array
          title: Failover Models
        current_user_permissions:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Current User Permissions
      type: object
      required:
        - app
        - active_models
        - base_model_settings
        - custom_model_settings
        - failover_models
      title: AppSettingsData
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    App:
      properties:
        auth0_id:
          type: string
          title: Auth0 Id
          description: The Auth0ID of the creator of the app
        modified_by:
          type: string
          title: Modified By
          description: The Auth0ID of the last person to modify the table
        org_id:
          type: string
          format: uuid
          title: Org Id
          description: The Org to which this App belongs
        prompt_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Prompt Id
          description: If any, the ID of the prompt associated with this app
        hashed_key:
          type: string
          title: Hashed Key
          description: The hashed value of the API Key which we store in our database
        key_end:
          type: string
          title: Key End
          description: The last characters of the API key
        name:
          type: string
          title: Name
          description: A name for this app
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: A description for this app
        app_logo:
          anyOf:
            - type: string
            - type: 'null'
          title: App Logo
          description: A logo for this app
        is_active:
          type: boolean
          title: Is Active
          description: True if the app is active (not soft-deleted, etc.), false otherwise
        rate_limit:
          type: integer
          title: Rate Limit
          default: 200
        has_failover_chain:
          type: boolean
          title: Has Failover Chain
          description: >-
            A Failover chain, when enabled, skips the SMART router and instead
            calls the failover chain in order.
        weights:
          $ref: '#/components/schemas/LLMModelWeights'
        policies:
          $ref: '#/components/schemas/LLMModelPolicies'
        settings:
          $ref: '#/components/schemas/LLMModelSettings'
        sandbox_of:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Sandbox Of
          description: The app might be a (testing) sandbox of a different App.
        use_parent_custom_data:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Use Parent Custom Data
          description: If true, the app will use the custom data of the parent app
        added_on:
          type: string
          format: date-time
          title: Added On
        modified_on:
          type: string
          format: date-time
          title: Modified On
        benchmark_model_id:
          type: string
          format: uuid
          title: Benchmark Model Id
          description: >-
            Compare the results of LLMs against this model (for speed, quality,
            cost...)
        id:
          type: string
          format: uuid
          title: Id
        benchmark_model:
          $ref: '#/components/schemas/ModelData'
          description: >-
            Compare the results of LLMs against this model (for speed, quality,
            cost...)
        prompt:
          anyOf:
            - $ref: '#/components/schemas/Prompt'
            - type: 'null'
          description: The Prompt associated to the app, if any
      type: object
      required:
        - auth0_id
        - modified_by
        - hashed_key
        - key_end
        - name
        - is_active
        - has_failover_chain
        - benchmark_model_id
        - id
        - benchmark_model
        - prompt
      title: App
    PulzeModelActiveForApp:
      properties:
        model:
          type: string
          title: Model
          description: The name of the model. Can belong to many providers
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
          description: The provider for the model.
        owner:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner
          description: >-
            The owner of the model. Sometimes, for a provider/model combination,
            many instances exist, trained on different data
        namespace:
          type: string
          title: Namespace
          description: The fully qualified (namespaced) model name
        at:
          anyOf:
            - type: string
            - type: 'null'
          title: At
          description: Extra model settings inferred from namespace
        context_window:
          type: integer
          title: Context Window
          description: The max_tokens for this model
        until:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Until
          description: The most recent data this model has been trained with
        description:
          type: string
          title: Description
          description: A description of the model
        url:
          type: string
          title: Url
          description: A URL to the model's page or more informatino
        api_target:
          type: string
          title: Api Target
          description: Store the name of the model the API requires
          default: ''
        deprecated_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deprecated On
          description: >-
            For models whose deprecation date is known (past or future), to show
            errors and deny service, or show warnings
        parent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Id
          description: The ID of parent, in case it's not a base model
        parent:
          anyOf:
            - $ref: '#/components/schemas/ModelData'
            - type: 'null'
        prompt_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Prompt Id
          description: The ID of prompt, used for this model
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
          description: Used to uniquely target models when we enable/disable them
        active:
          type: boolean
          title: Active
          description: Whether the model is active for the app.
          default: false
        globally_disabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Globally Disabled
          description: Whether the model is active for the org.
          default: false
      type: object
      required:
        - model
        - namespace
        - context_window
        - until
        - description
        - url
        - id
      title: PulzeModelActiveForApp
    ModelData:
      properties:
        supports_functions:
          type: boolean
          title: Supports Functions
          description: True if the model supports `function`/`tool` call
        supports_json:
          type: boolean
          title: Supports Json
          description: True if the model supports `json`-formatted responses
        supports_n:
          type: boolean
          title: Supports N
          description: >-
            True if the model supports `n` and `best_of` -- i.e, multiple
            responses
        supports_penalties:
          type: boolean
          title: Supports Penalties
          description: >-
            True if the model supports `frequency_penalty` and
            `presence_penalty`
        supports_stream:
          type: boolean
          title: Supports Stream
          description: True if the model supports streaming responses
        supports_vision:
          type: boolean
          title: Supports Vision
          description: True if the model supports image recognition (vision)
        completion_token_cost:
          type: number
          title: Completion Token Cost
          description: The cost of a completion token, in USD
        prompt_token_cost:
          type: number
          title: Prompt Token Cost
          description: The cost of a prompt token, in USD
        base_cost:
          type: number
          title: Base Cost
          description: >-
            A (usually 0) cost added on top of a request. Some models charge per
            request, not only per token
        price_unit:
          type: string
          enum:
            - tokens
            - characters
          title: Price Unit
          description: The unit of billing for this model
        model:
          type: string
          title: Model
          description: The name of the model. Can belong to many providers
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
          description: The provider for the model.
        owner:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner
          description: >-
            The owner of the model. Sometimes, for a provider/model combination,
            many instances exist, trained on different data
        namespace:
          type: string
          title: Namespace
          description: The fully qualified (namespaced) model name
        at:
          anyOf:
            - type: string
            - type: 'null'
          title: At
          description: Extra model settings inferred from namespace
        context_window:
          type: integer
          title: Context Window
          description: The max_tokens for this model
        until:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Until
          description: The most recent data this model has been trained with
        description:
          type: string
          title: Description
          description: A description of the model
        url:
          type: string
          title: Url
          description: A URL to the model's page or more informatino
        api_target:
          type: string
          title: Api Target
          description: Store the name of the model the API requires
          default: ''
        deprecated_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deprecated On
          description: >-
            For models whose deprecation date is known (past or future), to show
            errors and deny service, or show warnings
        parent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Id
          description: The ID of parent, in case it's not a base model
        parent:
          anyOf:
            - $ref: '#/components/schemas/ModelData'
            - type: 'null'
        prompt_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Prompt Id
          description: The ID of prompt, used for this model
        is_rag:
          type: boolean
          title: Is Rag
          description: Whether it's rag-tuned or not
        is_ft:
          type: boolean
          title: Is Ft
          description: Whether it's fine-tuned or not
        is_open_source:
          type: boolean
          title: Is Open Source
          description: True if the model is open source
        is_gdpr:
          type: boolean
          title: Is Gdpr
          description: True if the model complies with GDPR
        is_chat:
          type: boolean
          title: Is Chat
          description: >-
            True if the model is of type Chat Completions, False if it's a Text
            Completion model.
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
          description: The ID of this model
        app_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: App Id
          description: The app_id that has access to this model (if only one)
        org_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Org Id
          description: The org_id that has acccess to this model
        added_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Added By
          description: The user (auth0_id) who created the model
        added_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Added On
          description: When the model was added. Auto-populated in DB
        modified_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified On
          description: When the model was updated. Auto-populated in DB
        is_public:
          type: boolean
          title: Is Public
          description: True if the model is publicly accessible to all
        is_test_model:
          type: boolean
          title: Is Test Model
          description: >-
            Test models are only used for testing and do not perform any LLM
            requests
        is_pulze_owner:
          type: boolean
          title: Is Pulze Owner
          description: Model has been created and shared by Pulze
        default_active:
          type: boolean
          title: Default Active
          description: >-
            This determines if the model will be available + pre-selected when
            users create new apps.
      type: object
      required:
        - supports_functions
        - supports_json
        - supports_n
        - supports_penalties
        - supports_stream
        - supports_vision
        - completion_token_cost
        - prompt_token_cost
        - base_cost
        - price_unit
        - model
        - namespace
        - context_window
        - until
        - description
        - url
        - is_rag
        - is_ft
        - is_open_source
        - is_gdpr
        - is_chat
        - id
        - app_id
        - org_id
        - added_by
        - added_on
        - modified_on
        - is_public
        - is_test_model
        - is_pulze_owner
        - default_active
      title: ModelData
    Prompt:
      properties:
        prompt:
          type: string
          pattern: '[\s\S]*\{\{prompt\}\}[\s\S]*'
          title: Prompt
        title:
          type: string
          maxLength: 60
          minLength: 1
          title: Title
        description:
          type: string
          maxLength: 200
          minLength: 1
          title: Description
        added_on:
          type: string
          format: date-time
          title: Added On
        modified_on:
          type: string
          format: date-time
          title: Modified On
        org_id:
          type: string
          format: uuid
          title: Org Id
        tokens:
          type: integer
          title: Tokens
        published_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published On
        reviewed_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Reviewed On
        approved_on:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Approved On
        decline_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Decline Reason
          description: Reason for decline
        id:
          type: string
          format: uuid
          title: Id
      type: object
      required:
        - prompt
        - title
        - description
        - added_on
        - modified_on
        - org_id
        - tokens
        - published_on
        - reviewed_on
        - approved_on
        - id
      title: Prompt
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````