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

# Create a response

> Creates an OpenAI Responses API task. Returns 202 when background=true, otherwise returns 200 after completion.



## OpenAPI

````yaml POST /responses
openapi: 3.1.0
info:
  title: Valar API
  version: '2026-02-18'
  description: >-
    Valar exposes Responses and Chat Completions endpoints that match the OpenAI
    shape. This reference documents the fields Valar supports today.
servers:
  - url: https://api.valarhq.ai/v1
security:
  - BearerAuth: []
tags:
  - name: Models API
    description: Discover which models you can call.
  - name: Responses API
    description: Responses endpoints that follow the OpenAI interface.
  - name: Chat Completions API
    description: Chat Completions endpoints that follow the OpenAI interface.
  - name: Batches API
    description: Submit request batches and track their progress.
paths:
  /responses:
    post:
      tags:
        - Responses API
      summary: Create a response
      description: >-
        Starts a Responses API task in the OpenAI style. You get back 202 when
        you pass background=true; otherwise the call returns 200 once the work
        finishes.
      operationId: createResponse
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateResponseRequest'
            examples:
              basic:
                value:
                  model: zai-org/GLM-5.2-FP8
                  input: Explain the key ideas behind transformer architectures.
              background:
                value:
                  model: zai-org/GLM-5.2-FP8
                  input: Summarize this document.
                  background: true
                  metadata:
                    completion_window: standard
      responses:
        '200':
          description: The response finished and is returned to you right away.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
        '202':
          description: The response was queued and will be processed in the background.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
        '400':
          description: >-
            Your request was malformed or asked for something Valar does not
            support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: We could not authenticate the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Something went wrong on Valar's side.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: An upstream service returned an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: The request timed out before the result was ready.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Lets you retry safely. Valar records a reservation under the combination
        of organization, API key, and Idempotency-Key, so sending the same value
        again hands back the stored response rather than running inference a
        second time. Values can be up to 255 characters. See [Idempotent
        Requests](/idempotency) for the complete rules.
  schemas:
    CreateResponseRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
        input:
          $ref: '#/components/schemas/ResponseInput'
        max_output_tokens:
          oneOf:
            - type: integer
              minimum: 1
            - type: 'null'
        temperature:
          oneOf:
            - type: number
              minimum: 0
              maximum: 2
            - type: 'null'
        top_p:
          oneOf:
            - type: number
              minimum: 0
              maximum: 1
            - type: 'null'
        text:
          $ref: '#/components/schemas/ResponseTextConfiguration'
        reasoning:
          $ref: '#/components/schemas/ResponseReasoningConfiguration'
        background:
          type: boolean
        prompt_cache_key:
          type: string
          description: >-
            An optional hint Valar uses to keep prompt-prefix caches local.
            Requests sharing a key are steered toward the same place so you hit
            the cache more often.
        store:
          type: boolean
          enum:
            - true
          description: Must be true; no other value is accepted.
        truncation:
          type: string
          enum:
            - disabled
        stream:
          type: boolean
          enum:
            - false
          description: Streaming is not available on this endpoint yet.
        user:
          type: string
          maxLength: 256
        metadata:
          $ref: '#/components/schemas/RequestMetadata'
      additionalProperties: true
    ResponseObject:
      type: object
      required:
        - id
        - object
        - created_at
        - status
        - model
        - metadata
        - usage
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - response
        created_at:
          type: integer
        status:
          type: string
          enum:
            - pending
            - running
            - failed
            - completed
            - cancelled
        model:
          type: string
        input:
          $ref: '#/components/schemas/ResponseInput'
        output:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
            - type: object
              additionalProperties: true
            - type: 'null'
        error:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
        incomplete_details:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
        max_output_tokens:
          oneOf:
            - type: integer
            - type: 'null'
        reasoning:
          type: object
          additionalProperties: true
        text:
          $ref: '#/components/schemas/ResponseTextConfiguration'
        store:
          type: boolean
        temperature:
          type: number
        top_p:
          type: number
        parallel_tool_calls:
          type: boolean
        tool_choice:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        tools:
          type: array
          items:
            type: object
            additionalProperties: true
        truncation:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        usage:
          $ref: '#/components/schemas/ResponseUsage'
        user:
          oneOf:
            - type: string
            - type: 'null'
        metadata:
          type: object
          additionalProperties: true
      additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
      additionalProperties: false
    ResponseInput:
      description: >-
        Accepts text, and image input (input_image) when you target a multimodal
        model. Valar does not yet accept audio, files, or item references.
      oneOf:
        - type: string
          minLength: 1
        - type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ResponseInputMessage'
        - $ref: '#/components/schemas/ResponseInputObject'
    ResponseTextConfiguration:
      type: object
      required:
        - format
      properties:
        format:
          oneOf:
            - $ref: '#/components/schemas/ResponseTextFormat'
            - $ref: '#/components/schemas/ResponseJsonSchemaFormat'
      additionalProperties: false
    ResponseReasoningConfiguration:
      type: object
      properties:
        effort:
          type: string
          enum:
            - none
            - minimal
            - low
            - medium
            - high
            - xhigh
        generate_summary:
          type: string
          enum:
            - auto
            - concise
            - detailed
      additionalProperties: true
    RequestMetadata:
      type: object
      description: >-
        Optional string-valued metadata. Use completion_window to influence
        scheduling, and completion_webhook together with webhook_token to wire
        up a webhook that fires on completion.
      properties:
        completion_window:
          type: string
          description: >-
            The [completion window](/inference-modes#completion-windows), or
            latency tier, you want for this request. `asap` is the on-demand
            **Now** tier; `standard` is the lower-cost default; `flex` is the
            lowest-cost tier for background bulk work and **requires
            `background=true`**. Check the [Pricing](/pricing) page to see which
            windows each model supports. If you leave it out, Valar picks
            `standard` when the model supports it and falls back to `asap`
            otherwise; `flex` is never selected automatically. See [default
            behavior](/inference-modes#default-behavior).
          enum:
            - asap
            - standard
            - flex
        completion_webhook:
          type: string
          format: uri
        webhook_token:
          type: string
      additionalProperties:
        type: string
    ResponseUsage:
      type: object
      required:
        - input_tokens
        - input_tokens_details
        - output_tokens
        - output_tokens_details
        - total_tokens
      properties:
        input_tokens:
          type: integer
        input_tokens_details:
          $ref: '#/components/schemas/ResponseUsageDetails'
        output_tokens:
          type: integer
        output_tokens_details:
          $ref: '#/components/schemas/ResponseUsageDetails'
        total_tokens:
          type: integer
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
      additionalProperties: false
    ErrorObject:
      type: object
      required:
        - message
        - type
      properties:
        message:
          type: string
        type:
          type: string
        param:
          oneOf:
            - type: string
            - type: 'null'
        code:
          oneOf:
            - type: string
            - type: integer
            - type: 'null'
      additionalProperties: true
    ResponseInputMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
            - function
        content:
          oneOf:
            - type: string
            - type: array
              minItems: 1
              items:
                oneOf:
                  - $ref: '#/components/schemas/ResponseInputTextPart'
                  - $ref: '#/components/schemas/ResponseInputImagePart'
        name:
          type: string
        tool_calls:
          type: array
          items:
            type: object
            additionalProperties: true
        tool_call_id:
          type: string
        function_call:
          type: object
          additionalProperties: true
      additionalProperties: false
    ResponseInputObject:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ResponseInputMessage'
      additionalProperties: false
    ResponseTextFormat:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
      additionalProperties: false
    ResponseJsonSchemaFormat:
      type: object
      required:
        - type
        - name
      properties:
        type:
          type: string
          enum:
            - json_schema
        name:
          type: string
        description:
          type: string
        schema:
          type: object
          additionalProperties: true
        strict:
          type: boolean
      additionalProperties: false
    ResponseUsageDetails:
      type: object
      required:
        - cached_tokens
        - reasoning_tokens
      properties:
        cached_tokens:
          type: integer
        reasoning_tokens:
          type: integer
      additionalProperties: false
    ResponseInputTextPart:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - input_text
        text:
          type: string
      additionalProperties: false
    ResponseInputImagePart:
      type: object
      description: >-
        An image content part. You can only send image input to multimodal
        models; check the Models page to see which ones qualify.
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - input_image
        image_url:
          type: string
          description: >-
            Either a publicly reachable http(s) URL or a base64 data URI in the
            form data:<media-type>;base64,<data>.
        detail:
          type: string
          enum:
            - auto
            - low
            - high
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````