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

# LLM & streaming

> A scoped Chat Completions interface with explicit stream behavior.

> API preview: generation providers are not connected. An authenticated request can return 503 without creating a task or charging credits.

## Compatibility is per model

Chat Completions is the planned compatibility surface. Check messages, tools, structured output, vision, context limits, and usage support for the exact model. Do not infer complete OpenAI compatibility from the endpoint name.

Real LLM providers are not connected in this build stage. The example documents the intended request; it must not return invented model text as a live completion.

## Streaming changes recovery

* Before visible content is sent, an eligible confirmed failure may use an authorized fallback.
* After text, a tool call, or other visible SSE data is sent, do not restart on another supplier and concatenate a second answer.
* A client disconnect is not automatically free. Record known usage and resolve unknown metering according to the model’s published contract.
* Tools are instructions for your application. The platform must not repeat a tool action while recovering a stream.

## Keep platform extensions explicit

If an SDK rejects custom fields such as fallback, use its supported extra-body mechanism or plain HTTP. Use only valid SDK options. The 1–4 image/video output\_count field is not an LLM generation multiplier.


## OpenAPI

````yaml openapi.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: APIstable API preview
  version: 0.1.0-preview
  description: >-
    Current implemented HTTP surface. / 当前已实现的 HTTP 接口。 Models and quote prices
    are illustrative. Real providers and paid generation are not connected. POST
    /v1/tasks and /v1/chat/completions return 503 provider_not_configured after
    authentication and applicable validation; no credits are reserved or
    charged. Live 202 acceptance, provider callbacks, SSE, idempotent task
    creation, and full model capability adapters remain future integration work.
    Website login sessions are separate from application API keys.
servers:
  - url: https://apistable.com
    description: APIstable API
security: []
tags:
  - name: Models
  - name: Quotes
  - name: Tasks
  - name: Credits
  - name: LLM
paths:
  /v1/chat/completions:
    post:
      tags:
        - LLM
      summary: LLM placeholder / LLM 接口预留
      description: >-
        Requires generations:write. This build only checks authentication and
        returns 503 provider_not_configured; it does not parse or validate a
        Chat Completions request and does not create a stream. The request
        example is the intended future compatibility surface, not full OpenAI
        compatibility. After visible SSE output starts, a future implementation
        must not switch providers and concatenate another answer.
      operationId: chatCompletionsPreview
      requestBody:
        required: false
        description: Planned payload only; live request validation is not yet connected.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              model: nova-chat-4
              messages:
                - role: user
                  content: Hello
              stream: true
              fallback: false
      responses:
        '401':
          description: invalid_api_key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: insufficient_scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            provider_not_configured or service_unavailable; no model text or SSE
            stream is returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: APIstable API key
      description: >-
        API key beginning as_. Keep on the server. Scope permissions are checked
        separately.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.