Ollama Responses API

Generate structured responses with optional reasoning using the OpenAI-compatible Responses API.

OpenAPI Specification

ollama-responses-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Ollama Blobs Responses API
  description: Ollama provides a REST API for running and managing large language models locally. The API supports text generation, chat completions, embeddings, model management, and streaming responses. It serves as the primary interface for interacting with models running on the Ollama inference engine at localhost:11434.
  version: 0.1.0
  contact:
    name: Ollama Team
    url: https://ollama.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  termsOfService: https://ollama.com/terms
servers:
- url: http://localhost:11434
  description: Local Ollama Server
tags:
- name: Responses
  description: Generate structured responses with optional reasoning using the OpenAI-compatible Responses API.
paths:
  /responses:
    post:
      operationId: createResponse
      summary: Ollama Create response
      description: Creates a structured response with optional reasoning. Supports streaming, tool calling, and reasoning summaries. Compatible with the OpenAI Responses API format. Added in Ollama v0.13.3.
      tags:
      - Responses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponseRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ResponseStreamEvent'
        '400':
          description: Bad Request
        '404':
          description: Model not found
components:
  schemas:
    ResponseObject:
      type: object
      description: Response object from the Responses API.
      properties:
        id:
          type: string
          description: A unique identifier for the response.
        object:
          type: string
          description: The object type.
        created_at:
          type: integer
          description: Unix timestamp of when the response was created.
        model:
          type: string
          description: The model used.
        output:
          type: array
          description: The output items generated by the model.
          items:
            type: object
            additionalProperties: true
        usage:
          $ref: '#/components/schemas/UsageStats'
    ResponseRequest:
      type: object
      description: Request body for the Responses API in OpenAI-compatible format.
      required:
      - model
      - input
      properties:
        model:
          type: string
          description: The model to use for generating the response.
        input:
          description: The input to generate a response for. Can be a string or an array of input items.
          oneOf:
          - type: string
          - type: array
            items:
              type: object
              additionalProperties: true
        instructions:
          type: string
          description: System-level instructions for the model.
        tools:
          type: array
          description: A list of tools the model may call.
          items:
            $ref: '#/components/schemas/OpenAIToolDefinition'
        stream:
          type: boolean
          description: Whether to stream the response.
          default: false
        temperature:
          type: number
          description: Sampling temperature between 0 and 2.
          minimum: 0.0
          maximum: 2.0
        top_p:
          type: number
          description: Nucleus sampling parameter.
          minimum: 0.0
          maximum: 1.0
        max_output_tokens:
          type: integer
          description: Maximum number of output tokens to generate.
    ResponseStreamEvent:
      type: object
      description: A streaming event from the Responses API.
      properties:
        type:
          type: string
          description: The type of streaming event.
        data:
          type: object
          description: The event data payload.
          additionalProperties: true
    UsageStats:
      type: object
      description: Token usage statistics for the request.
      properties:
        prompt_tokens:
          type: integer
          description: Number of tokens in the prompt.
        completion_tokens:
          type: integer
          description: Number of tokens in the generated completion.
        total_tokens:
          type: integer
          description: Total number of tokens used in the request.
    OpenAIToolDefinition:
      type: object
      description: A tool definition in OpenAI-compatible format.
      required:
      - type
      - function
      properties:
        type:
          type: string
          description: The type of tool. Currently only function is supported.
          enum:
          - function
        function:
          type: object
          description: The function definition.
          required:
          - name
          properties:
            name:
              type: string
              description: The name of the function.
            description:
              type: string
              description: A description of what the function does.
            parameters:
              type: object
              description: The function parameters as a JSON Schema object.
              additionalProperties: true
externalDocs:
  description: Ollama API Documentation
  url: https://docs.ollama.com/api/introduction