> ## 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 与流式输出

> 明确兼容范围与流式行为的 Chat Completions 接口。

> 当前为 API 预览。生成接口尚未接入供应商，成功认证后仍可能返回 503；不会创建任务或扣积分。

## 兼容能力按模型公布

计划提供 Chat Completions 兼容接口。应逐模型确认 messages、tools、结构化输出、视觉、上下文与 usage 支持，不能从端点名称推断完全兼容 OpenAI。

当前阶段尚未接入真实 LLM 供应商。示例说明预期请求，不应将虚构文本当作真实模型返回。

## 流式输出影响恢复策略

* 尚未向客户端发送可见内容时，符合条件的明确失败可使用已授权 fallback。
* 发送文本、工具调用或其他可见 SSE 后，不能换供应商重启并拼接第二份答案。
* 客户端断开不自动免费；记录已知用量，未知计量按该模型已发布契约核对。
* 工具调用由你的应用执行；平台恢复流时不能重复触发工具动作。

## 明确平台扩展字段

若 SDK 不接受 fallback 等扩展字段，使用该 SDK 支持的 extra-body 机制或普通 HTTP，不写无效选项。图片/视频的 output\_count 不自动扩展为 LLM 生成数量。


## 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.