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

# Proof of Sentience API

> Tap into Galadriel's verified inference which powers Daige's Proof of Sentience. Returns additional proof metadata on top of OpenAI's chat completion API.

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "id",
    "choices": [
      {
        "finish_reason": "stop",
        "index": 0,
        "logprobs": null,
        "message": {
          "content": "Hello! How can I assist you today?",
          "refusal": null,
          "role": "assistant",
          "function_call": null,
          "tool_calls": null,
          "audio": null
        }
      }
    ],
    "created": 1728558433,
    "model": "gpt-4o-2024-08-06",
    "object": "chat.completion",
    "service_tier": null,
    "system_fingerprint": "fp_9faba9f038",
    "usage": {
      "completion_tokens": 9,
      "prompt_tokens": 19,
      "total_tokens": 28,
      "completion_tokens_details": {
        "accepted_prediction_tokens": 0,
        "audio_tokens": 0,
        "reasoning_tokens": 0,
        "rejected_prediction_tokens": 0
      },
      "prompt_tokens_details": {
        "audio_tokens": 0,
        "cached_tokens": 0
      }
    },
    "hash": "2c88aacb88de8b85a23e648eff20941285c16bb63cf9467811ee15bb64a40445",
    "public_key": "Dp2k554Ebsij5RjuhjsZujVW2bJnQzfb43VYZSQ4NZo1",
    "signature": "f298c3b1294221d1200041993818cfbfec66f33d1071ea821e5068978099cd60179dbf66839570dd9ada5f661e7d8475a03b536f42e540db3bed6f21d5741301",
    "tx_hash": "e495424c395c501fb8fc013738fb481be85c1fbce9e595c308c31792983b2ffa10eca9c7dda0c8768ce12d0ff49a089cd5068d847eea8ae7544d5435d7f6010d",
    "attestation": "enclave attestation"
  }
  ```

  ```json 422 theme={null}
  {
    "detail": [
      {
        "loc": [
          "string",
          0
        ],
        "msg": "string",
        "type": "string"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml post /v1/verified/chat/completions
openapi: 3.1.0
info:
  title: API
  description: API version 1.0.0
  version: 1.0.0
  contact:
    name: ''
    email: kristjan@galadriel.com
  x-logo:
    url: ''
servers:
  - url: https://api.galadriel.com
security: []
paths:
  /v1/verified/chat/completions:
    post:
      tags:
        - Verified Chat
      summary: Creates a model response for the given chat conversation.
      description: >-
        Given a list of messages comprising a conversation, the model will
        return a response.
      operationId: completions_v1_verified_chat_completions_post
      parameters:
        - name: Fine-Tune-Authorization
          in: header
          required: false
          schema:
            type: string
          description: >-
            Optional bearer authentication header for calling a fine-tuned model
            hosted on external service like OpenAI or Anthropic.


            When a fine-tuned model is provided in the `model` field in body,
            you must pass the authentication key which has the access to that
            model.


            The header should be in the format eg. `Bearer OpenAI-API-Key`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/distributedinference__service__verified_completions__entities__ChatCompletionRequest
      responses:
        '200':
          description: >-
            Returns a chat completion object, or a streamed sequence of chat
            completion chunk objects if the request is streamed.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/distributedinference__service__verified_completions__entities__ChatCompletion
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    distributedinference__service__verified_completions__entities__ChatCompletionRequest:
      properties:
        messages:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Messages
          description: 'A list of messages comprising the conversation so far. '
        model:
          type: string
          title: Model
          description: >-
            ID of the model to use. The requested model is forwarded to OpenAI
            without modifications.
        frequency_penalty:
          anyOf:
            - type: number
            - type: 'null'
          title: Frequency Penalty
          description: >-
            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.
        logit_bias:
          anyOf:
            - type: object
            - type: 'null'
          title: Logit Bias
          description: >-
            Modify the likelihood of specified tokens appearing in the
            completion.
        logprobs:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Logprobs
          description: >-
            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`.
        top_logprobs:
          anyOf:
            - type: integer
            - type: 'null'
          title: Top Logprobs
          description: >-
            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.
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
          description: The maximum number of tokens to generate in the chat completion.
        'n':
          anyOf:
            - type: integer
            - type: 'null'
          title: 'N'
          description: How many chat completion choices to generate for each input message.
        presence_penalty:
          anyOf:
            - type: number
            - items: {}
              type: array
            - type: 'null'
          title: Presence Penalty
          description: >-
            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.
        response_format:
          anyOf:
            - $ref: '#/components/schemas/ResponseFormat'
            - type: 'null'
          description: An object specifying the format that the model must output.
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
          description: >-
            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.
        stop:
          anyOf:
            - type: string
            - items: {}
              type: array
            - type: 'null'
          title: Stop
          description: Up to 4 sequences where the API will stop generating further tokens.
        stream:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Stream
          description: If set, partial message deltas will be sent, like in ChatGPT.
        stream_options:
          anyOf:
            - $ref: '#/components/schemas/StreamOptions'
            - type: 'null'
          description: >-
            Options for streaming response. Only set this when you set `stream:
            true`.
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
          description: >-
            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.
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
          description: >-
            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.
        tools:
          anyOf:
            - items:
                $ref: >-
                  #/components/schemas/distributedinference__service__verified_completions__entities__Tool
              type: array
            - type: 'null'
          title: Tools
          description: >-
            **Currently the 8b model does not support tools.** 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.
        tool_choice:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/ToolChoice'
            - type: 'null'
          title: Tool Choice
          description: >-
            Controls which (if any) tool is called by the model. none means the
            model will not call any tool and instead generates a message. auto
            means the model can pick between generating a message or calling one
            or more tools. required means the model must call one or more tools.
            Specifying a particular tool via `{"type": "function", "function":
            {"name": "my_function"}}` forces the model to call that tool.
        user:
          anyOf:
            - type: string
            - type: 'null'
          title: User
          description: >-
            A unique identifier representing your end-user, which can help
            OpenAI to monitor and detect abuse.
      type: object
      required:
        - messages
        - model
      title: ChatCompletionRequest
      example:
        messages:
          - content: You are a helpful assistant.
            role: system
          - content: Hello!
            role: user
        model: gpt-4o
    distributedinference__service__verified_completions__entities__ChatCompletion:
      properties:
        id:
          type: string
          title: Id
        choices:
          items:
            $ref: '#/components/schemas/Choice'
          type: array
          title: Choices
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        object:
          type: string
          const: chat.completion
          title: Object
        service_tier:
          anyOf:
            - type: string
              enum:
                - scale
                - default
            - type: 'null'
          title: Service Tier
        system_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: System Fingerprint
        usage:
          anyOf:
            - $ref: '#/components/schemas/CompletionUsage'
            - type: 'null'
        hash:
          type: string
          title: Hash
          description: The SHA-256 hash of the request and response
        public_key:
          type: string
          title: Public Key
          description: Signer public key
        signature:
          type: string
          title: Signature
          description: >-
            The signature of the hash, signed by the Solana account in hex
            format.
        attestation:
          type: string
          title: Attestation
          description: The attestation document.
      additionalProperties: true
      type: object
      required:
        - id
        - choices
        - created
        - model
        - object
        - hash
        - public_key
        - signature
        - attestation
      title: ChatCompletion
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Message:
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: >-
            The contents of the message. `content` is required for all messages,
            and may be null for assistant messages with function calls.
        function_call:
          anyOf:
            - $ref: '#/components/schemas/FunctionCall-Input'
            - type: 'null'
          description: >-
            The name and arguments of a function that should be called, as
            generated by the model.
        role:
          type: string
          title: Role
          description: 'One of: `system`, `assistant`, `user` or `tool`'
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            The name of the author of this message. `name` is required if `role`
            is `function`, and it should be the name of the function whose
            response is in the content. May contain a-z, A-Z, 0-9, and
            underscores, with a maximum length of 64 characters.
      type: object
      required:
        - content
        - role
      title: Message
    ResponseFormat:
      properties:
        type:
          type: string
          enum:
            - text
            - json_object
            - json_schema
          title: Type
          description: 'The type of response format being defined: `text`'
        json_schema:
          anyOf:
            - $ref: '#/components/schemas/JsonSchema'
            - type: 'null'
      type: object
      required:
        - type
      title: ResponseFormat
    StreamOptions:
      properties:
        include_usage:
          type: boolean
          title: Include Usage
          description: >-
            If set, an additional chunk will be streamed before the `data:
            [DONE]` message. The usage field on this chunk shows the token usage
            statistics for the entire request, and the choices field will always
            be an empty array. All other chunks will also include a usage field,
            but with a null value.
      type: object
      required:
        - include_usage
      title: StreamOptions
    distributedinference__service__verified_completions__entities__Tool:
      properties:
        type:
          anyOf:
            - type: string
              const: function
            - type: 'null'
          title: Type
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: >-
            #/components/schemas/distributedinference__service__verified_completions__entities__Function
      type: object
      required:
        - type
        - function
      title: Tool
    ToolChoice:
      properties:
        type:
          anyOf:
            - type: string
              const: function
            - type: 'null'
          title: Type
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: '#/components/schemas/ToolChoiceFunction'
      type: object
      required:
        - type
        - function
      title: ToolChoice
    Choice:
      properties:
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
            - function_call
          title: Finish Reason
        index:
          type: integer
          title: Index
        logprobs:
          anyOf:
            - $ref: '#/components/schemas/ChoiceLogprobs'
            - type: 'null'
        message:
          $ref: '#/components/schemas/ChatCompletionMessage'
      additionalProperties: true
      type: object
      required:
        - finish_reason
        - index
        - message
      title: Choice
    CompletionUsage:
      properties:
        completion_tokens:
          type: integer
          title: Completion Tokens
        prompt_tokens:
          type: integer
          title: Prompt Tokens
        total_tokens:
          type: integer
          title: Total Tokens
      additionalProperties: true
      type: object
      required:
        - completion_tokens
        - prompt_tokens
        - total_tokens
      title: CompletionUsage
    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
    FunctionCall-Input:
      properties:
        arguments:
          type: string
          title: Arguments
          description: >-
            The name and arguments of a function that should be called, as
            generated by the model.
        name:
          type: string
          title: Name
          description: The name of the function to call.
      type: object
      required:
        - arguments
        - name
      title: FunctionCall
    JsonSchema:
      properties:
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            A description of what the response format is for, used by the model
            to determine how to respond in the format.
        name:
          type: string
          title: Name
          description: >-
            The name of the response format. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.
        schema:
          anyOf:
            - type: object
            - type: 'null'
          title: Schema
          description: >-
            The schema for the response format, described as a JSON Schema
            object.
        strict:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Strict
          description: >-
            Whether to enable strict schema adherence when generating the
            output. If set to true, the model will always follow the exact
            schema defined in the schema field. Only a subset of JSON Schema is
            supported when `strict` is `true`.
      type: object
      required:
        - name
        - schema
      title: JsonSchema
    distributedinference__service__verified_completions__entities__Function:
      properties:
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            A description of what the function does, used by the model to choose
            when and how to call the function.
        name:
          type: string
          title: Name
          description: >-
            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.
        parameters:
          type: object
          title: Parameters
          description: >-
            The parameters the functions accepts, described as a JSON Schema
            object. See the guide for examples, and the JSON Schema reference
            for documentation about the format. To describe a function that
            accepts no parameters, provide the value {"type": "object",
            "properties": {}}.
        strict:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Strict
          description: >-
            Whether to enable strict schema adherence when generating the
            function call. If set to true, the model will follow the exact
            schema defined in the parameters field. Only a subset of JSON Schema
            is supported when `strict` is `true`.
      type: object
      required:
        - name
        - parameters
      title: Function
    ToolChoiceFunction:
      properties:
        name:
          type: string
          title: Name
          description: The name of the function to call.
      type: object
      required:
        - name
      title: ToolChoiceFunction
    ChoiceLogprobs:
      properties:
        content:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
              type: array
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
              type: array
            - type: 'null'
          title: Refusal
      additionalProperties: true
      type: object
      title: ChoiceLogprobs
    ChatCompletionMessage:
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - type: string
            - type: 'null'
          title: Refusal
        role:
          type: string
          const: assistant
          title: Role
        function_call:
          anyOf:
            - $ref: '#/components/schemas/FunctionCall-Output'
            - type: 'null'
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionMessageToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
      additionalProperties: true
      type: object
      required:
        - role
      title: ChatCompletionMessage
    ChatCompletionTokenLogprob:
      properties:
        token:
          type: string
          title: Token
        bytes:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Bytes
        logprob:
          type: number
          title: Logprob
        top_logprobs:
          items:
            $ref: '#/components/schemas/TopLogprob'
          type: array
          title: Top Logprobs
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
        - top_logprobs
      title: ChatCompletionTokenLogprob
    FunctionCall-Output:
      properties:
        arguments:
          type: string
          title: Arguments
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      required:
        - arguments
        - name
      title: FunctionCall
    ChatCompletionMessageToolCall:
      properties:
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/Function-Output'
        type:
          type: string
          const: function
          title: Type
      additionalProperties: true
      type: object
      required:
        - id
        - function
        - type
      title: ChatCompletionMessageToolCall
    TopLogprob:
      properties:
        token:
          type: string
          title: Token
        bytes:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Bytes
        logprob:
          type: number
          title: Logprob
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
      title: TopLogprob
    Function-Output:
      properties:
        arguments:
          type: string
          title: Arguments
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      required:
        - arguments
        - name
      title: Function
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: |-
        Bearer authentication header.

        example value: `Bearer Galadriel-API-key`

        Get API key from [Galadriel dashboard](https://dashboard.galadriel.com).
      in: header
      name: Authorization

````