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

# Run Prompt

> Runs the published version of a prompt template identified by its slug.
Template variables in `{{variable}}` format are resolved from the
`variables` map in the request body.




## OpenAPI

````yaml POST /prompt/{slug}/run
openapi: 3.0.3
info:
  title: Traceport Gateway API
  description: |
    OpenAI-compatible unified gateway API for Traceport.
    Supports multiple LLM providers (OpenAI, Anthropic, Google, Bedrock) through
    a single set of endpoints. All endpoints require API key authentication via
    the `Authorization: Bearer <api-key>` header.
  version: 1.0.0
  contact:
    name: Traceport
    url: https://traceport.ai
servers:
  - url: /v1
    description: API v1
security:
  - BearerAuth: []
tags:
  - name: Chat Completions
    description: Create chat completions (supports streaming)
  - name: Embeddings
    description: Create text embeddings
  - name: Batches
    description: Manage batch processing jobs
  - name: Files
    description: Upload and manage files for batch processing
  - name: Workflow
    description: Execute server-side workflows
  - name: Prompts
    description: Run published prompt templates
  - name: Realtime
    description: Build interactive, low-latency AI applications with persistent connections
paths:
  /prompt/{slug}/run:
    post:
      tags:
        - Prompts
      summary: Run Prompt
      description: |
        Runs the published version of a prompt template identified by its slug.
        Template variables in `{{variable}}` format are resolved from the
        `variables` map in the request body.
      operationId: runPrompt
      parameters:
        - name: slug
          in: path
          required: true
          description: Unique slug identifier for the prompt template.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptRunRequest'
      responses:
        '200':
          description: Chat completion result from the prompt run
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Prompt or published version not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    PromptRunRequest:
      type: object
      properties:
        model:
          type: string
          description: |
            Model to use for the prompt run. If omitted, the model
            from the prompt's model_params is used.
        variables:
          type: object
          additionalProperties: true
          description: |
            Key-value map of template variables. Each `{{key}}` in the
            prompt messages is replaced with the corresponding value.
    ChatResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: chat.completion
        created:
          type: integer
          format: int64
        model:
          type: string
        choices:
          type: array
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
        system_fingerprint:
          type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
    Choice:
      type: object
      properties:
        index:
          type: integer
        message:
          $ref: '#/components/schemas/Message'
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
        logprobs:
          $ref: '#/components/schemas/LogProbs'
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        prompt_tokens_details:
          $ref: '#/components/schemas/PromptTokensDetails'
        completion_tokens_details:
          $ref: '#/components/schemas/CompletionTokensDetails'
        cache_creation_input_tokens:
          type: integer
          description: Anthropic — tokens used to create the cache.
        cache_read_input_tokens:
          type: integer
          description: Anthropic — tokens read from cache.
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
          description: Role of the message author.
        content:
          description: |
            Message content — either a plain string or an array of
            `ContentPart` objects for multimodal input.
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentPart'
        name:
          type: string
          description: Optional participant name.
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
          description: Tool calls generated by the assistant.
        tool_call_id:
          type: string
          description: ID of the tool call this message is responding to.
    LogProbs:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/LogProbContent'
    PromptTokensDetails:
      type: object
      properties:
        cached_tokens:
          type: integer
    CompletionTokensDetails:
      type: object
      properties:
        reasoning_tokens:
          type: integer
        accepted_prediction_tokens:
          type: integer
        rejected_prediction_tokens:
          type: integer
    ContentPart:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
        text:
          type: string
        image_url:
          $ref: '#/components/schemas/ImageURL'
    ToolCall:
      type: object
      required:
        - id
        - type
        - function
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/FunctionCall'
    LogProbContent:
      type: object
      properties:
        token:
          type: string
        logprob:
          type: number
          format: double
        bytes:
          type: array
          items:
            type: integer
        top_logprobs:
          type: array
          items:
            type: object
            properties:
              token:
                type: string
              logprob:
                type: number
                format: double
              bytes:
                type: array
                items:
                  type: integer
    ImageURL:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
        detail:
          type: string
          enum:
            - auto
            - low
            - high
    FunctionCall:
      type: object
      required:
        - name
        - arguments
      properties:
        name:
          type: string
        arguments:
          type: string
          description: JSON-encoded function arguments.
  responses:
    BadRequest:
      description: Bad request — invalid or missing parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized — missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key passed as a Bearer token.

````