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

> ## Agent Instructions
> Krun API base URL: https://api.krun.ai. Authenticate server-side with `Authorization: Bearer $KRUN_API_KEY`; never put a Krun API key in browser code.
> Prefer the Python SDK in examples: `pip install krun-ai`, `from krun import Krun`. The TypeScript SDK is `npm install @krun-ai/sdk` (Node.js 20+, server-side only); multimodal inputs, `multi` and assets need `@krun-ai/sdk` >= 0.3.0 and `krun-ai` >= 0.3.0.
> Question types: `choice`, `noul`, `score` and `multi`. The current model is `krun-one-v1` (`krun-one-v0` and `krun-one-v0.3` are aliases). `context` is a string or a list of content parts (`text`, `image`, `document`, `audio` by `asset_id` from `POST /v1/assets`). Use client timeouts of at least 180 s: cold starts can take up to about 2 minutes. `confidence` is the top-1 minus top-2 probability margin, not the probability that the answer is correct. `choice` is null when `abstain` is true.
> Usage reports `input_tokens` only. There are no output tokens.

# Upload asset

> Upload an image, document or audio file for use in a multimodal `context`. The request body is the raw file (not JSON or multipart), and `Content-Type` is its MIME type, checked against the content. Assets are project-scoped and expire 24 hours after upload.



## OpenAPI

````yaml https://api.krun.ai/openapi.json post /v1/assets
openapi: 3.1.0
info:
  title: Krun API
  description: >-
    Krun decision API. Authenticate with `Authorization: Bearer krun_live_...`
    from your server.
  version: 1.0.0-beta
servers:
  - url: https://api.krun.ai
    description: Production
security: []
tags:
  - name: decisions
    description: 'Decide on a context with typed questions: choice, noul, score'
  - name: feedback
    description: Report whether a decision was correct
  - name: models
    description: Available models
  - name: health
    description: Liveness and readiness
  - name: assets
    description: Media files for decision contexts.
paths:
  /v1/assets:
    post:
      tags:
        - assets
      summary: Upload asset
      description: >-
        Upload an image, document or audio file for use in a multimodal
        `context`. The request body is the raw file (not JSON or multipart), and
        `Content-Type` is its MIME type, checked against the content. Assets are
        project-scoped and expire 24 hours after upload.
      operationId: create_asset
      requestBody:
        content:
          application/pdf:
            schema:
              type: string
              format: binary
          application/vnd.openxmlformats-officedocument.wordprocessingml.document:
            schema:
              type: string
              format: binary
          audio/flac:
            schema:
              type: string
              format: binary
          audio/mpeg:
            schema:
              type: string
              format: binary
          audio/ogg:
            schema:
              type: string
              format: binary
          audio/wav:
            schema:
              type: string
              format: binary
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/webp:
            schema:
              type: string
              format: binary
          text/html:
            schema:
              type: string
          text/markdown:
            schema:
              type: string
          text/plain:
            schema:
              type: string
        required: true
      responses:
        '201':
          description: Asset created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '413':
          description: ASSET_TOO_LARGE
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '415':
          description: >-
            UNSUPPORTED_MIME_TYPE (type not supported, or the content does not
            match it).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '429':
          description: Rate limited.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - api_key: []
components:
  schemas:
    Asset:
      type: object
      description: An uploaded media file, usable only by the project that uploaded it.
      required:
        - id
        - object
        - mime_type
        - size_bytes
        - sha256
        - created_at
        - expires_at
      properties:
        id:
          type: string
          description: 'Id of an asset uploaded with `POST /v1/assets` by the same project. '
          pattern: ^asset_[A-Za-z0-9_-]{8,64}$
        object:
          type: string
          enum:
            - asset
        mime_type:
          type: string
        size_bytes:
          type: integer
          format: int64
        sha256:
          type: string
        created_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
          description: >-
            After this time the asset can no longer be referenced (default 24 h
            after upload).
    ErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable machine-readable code.
        message:
          type: string
        request_id:
          type:
            - string
            - 'null'
          example: req_0b7f7c5e9a3d4a8c9f1e2d3c4b5a6978
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_OPTIONS
        - PAYLOAD_TOO_LARGE
        - UNAUTHORIZED
        - FORBIDDEN
        - SIGNUP_RESTRICTED
        - NOT_FOUND
        - CONFLICT
        - INSUFFICIENT_CREDITS
        - RATE_LIMITED
        - QUOTA_EXCEEDED
        - UPSTREAM_TIMEOUT
        - UPSTREAM_UNAVAILABLE
        - INFERENCE_FAILED
        - INTERNAL_ERROR
        - UNSUPPORTED_MODALITY
        - UNSUPPORTED_MIME_TYPE
        - ASSET_NOT_FOUND
        - ASSET_FORBIDDEN
        - ASSET_EXPIRED
        - ASSET_TOO_LARGE
        - TOO_MANY_IMAGES
        - TOO_MANY_DOCUMENTS
        - TOO_MANY_AUDIO
        - DOCUMENT_TOO_MANY_PAGES
        - AUDIO_TOO_LONG
        - DECODE_FAILED
        - OCR_FAILED
        - ASR_FAILED
        - VISION_FAILED
        - MULTIMODAL_INFERENCE_FAILED
  securitySchemes:
    api_key:
      type: http
      scheme: bearer
      bearerFormat: krun_live_...

````