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

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# 解除支出拦截

> 让支出拦截范围内的请求重新通过。

需要 `spend_rules:write`。OAuth 调用方必须是工作区所有者或管理员。拦截在同一周期内不会再次开始（滚动规则为一个窗口内），并会发送 **支出拦截** 通知。请求大约一分钟内即可看到变化。


## OpenAPI

````yaml zh-Hans/openapi/v1/openapi.localized.yaml POST /spend-blocks/{id}/lift
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: 通过兼容 OpenAI 的端点访问各种 AI 模型的网关 API。
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: 全球路由
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /spend-blocks/{id}/lift:
    parameters:
      - name: id
        in: path
        required: true
        description: 支出拦截 ID。
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Gateway
      summary: 解除支出拦截
      description: >-
        解除生效中的支出拦截，使其范围内的请求在约一分钟内重新被接受。在周期重置前，规则不会再次拦截，但会继续发送警报。仅限所有者和管理员；解除操作会记录在审计日志中，并排队一个状态为
        lifted 的 spend_blocked 事件。拦截不存在时返回 404，已被解除时返回 409
        spend_block_not_active。
      operationId: liftSpendBlock
      responses:
        '200':
          description: 已解除的支出拦截
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpendBlockResponse'
        default:
          description: 请求失败
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SpendBlockResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/SpendBlock'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        ok:
          type: boolean
          example: false
        error:
          description: >-
            OpenAI 兼容 SDK 读取的错误对象（`code`、`message`、`type`、`param` 以及可选的
            `metadata`）。以前的响应在此处返回代码字符串；现在它也作为顶层 `code` 返回。
          oneOf:
            - type: string
            - $ref: '#/components/schemas/ErrorObject'
          example:
            code: validation_error
            message: 'Unknown parameter: foo'
            type: invalid_request_error
            param: foo
        code:
          type: string
          description: 错误代码，与 `error.code` 的值相同。
          example: validation_error
        message:
          type: string
          example: Human-readable error message
        description:
          type: string
          example: Additional error details.
        generation_id:
          type: string
          example: G-abc123
        status_code:
          type: integer
          example: 502
        error_type:
          type: string
          enum:
            - user
            - system
          example: system
        error_origin:
          type: string
          enum:
            - user
            - gateway
            - upstream
          example: upstream
        reason:
          type: string
          example: all_candidates_failed
        attempt_count:
          type: integer
          example: 2
        failed_providers:
          type: array
          items:
            type: string
          example:
            - google-ai-studio
            - openai
        failed_statuses:
          type: array
          items:
            type: integer
          example:
            - 403
            - 429
        upstream_error:
          $ref: '#/components/schemas/ErrorUpstreamError'
        failure_sample:
          type: array
          items:
            $ref: '#/components/schemas/ErrorFailureSampleItem'
        provider_failure_diagnostics:
          $ref: '#/components/schemas/ErrorProviderFailureDiagnostics'
        routing_diagnostics:
          $ref: '#/components/schemas/ErrorRoutingDiagnostics'
        provider_candidate_diagnostics:
          $ref: '#/components/schemas/ErrorProviderCandidateDiagnostics'
        provider_enablement:
          $ref: '#/components/schemas/ErrorProviderEnablementDiagnostics'
        missing_pricing_providers:
          type: array
          items:
            type: string
        provider_payment_required_provider:
          type: string
          example: openai
        provider_payment_required_support_notice:
          type: string
          example: >-
            Our upstream provider billing appears to be unavailable. If this
            persists, contact support.
        details:
          type: array
          items:
            type: object
            additionalProperties: true
      additionalProperties: true
    SpendBlock:
      type: object
      description: >-
        支出达到拦截点时由支出规则启动的拦截。生效期间，范围内的请求会收到代码为 spend_rule_blocked 的
        429，Retry-After 设为 resets_at。除非 block_free_models 为 true，否则免费模型不受影响。
      required:
        - id
        - workspace_id
        - rule_id
        - rule_name
        - scope_type
        - scope_id
        - scope_label
        - block_free_models
        - period_start
        - resets_at
        - spend_nanos
        - spend_usd
        - limit_nanos
        - limit_usd
        - started_at
        - lifted_at
        - lifted_by
        - lift_reason
        - active
      properties:
        id:
          type: string
          format: uuid
        workspace_id:
          type: string
          format: uuid
        rule_id:
          type: string
          format: uuid
          nullable: true
          description: 启动此拦截的规则；规则被彻底删除后为 null。
        rule_name:
          type: string
          nullable: true
        scope_type:
          $ref: '#/components/schemas/SpendRuleScope'
        scope_id:
          type: string
          nullable: true
        scope_label:
          type: string
          description: 范围的显示名称（密钥、部门或模型名称、成员邮箱，或 ID）。
        block_free_models:
          type: boolean
        period_start:
          type: string
          format: date-time
        resets_at:
          type: string
          format: date-time
          nullable: true
          description: 拦截自动解除的时间（规则周期结束时）。
        spend_nanos:
          type: integer
          description: 拦截开始时规则范围内的支出，单位为纳美元。
        spend_usd:
          type: number
        limit_nanos:
          type: integer
          description: 拦截点，单位为纳美元。
        limit_usd:
          type: number
        started_at:
          type: string
          format: date-time
        lifted_at:
          type: string
          format: date-time
          nullable: true
        lifted_by:
          type: string
          format: uuid
          nullable: true
          description: 手动解除时，解除拦截的所有者或管理员。
        lift_reason:
          allOf:
            - $ref: '#/components/schemas/SpendBlockLiftReason'
          nullable: true
        active:
          type: boolean
          description: 未解除，且尚未到重置时间。
    ErrorObject:
      type: object
      description: >-
        采用 OpenAI SDK 读取格式的网关错误。`type` 由 HTTP 状态决定：大多数 4xx 为
        invalid_request_error，authentication_error（401）、insufficient_quota（402）、permission_error（403）、not_found_error（404）、rate_limit_error（429）、service_unavailable（503）、overloaded（529），其他
        5xx 为 server_error。
      required:
        - code
        - message
        - type
      properties:
        code:
          type: string
          description: 机器可读的错误代码。
          example: validation_error
        message:
          type: string
          description: 便于阅读的失败说明。
          example: 'Unknown parameter: foo'
        type:
          type: string
          description: 错误类型，遵循 OpenAI 文档中的错误类型。
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - not_found_error
            - rate_limit_error
            - insufficient_quota
            - server_error
            - service_unavailable
            - overloaded
          example: invalid_request_error
        param:
          type: string
          nullable: true
          description: 导致错误的请求参数（如已知）。
          example: foo
        metadata:
          type: object
          description: >-
            同样在顶层返回的结构化详情，例如失败的提供商、`reason`、`failed_statuses`、`retry_after_seconds`
            或 `upstream_error`。
          additionalProperties: true
      additionalProperties: true
    ErrorUpstreamError:
      type: object
      properties:
        code:
          type: string
          nullable: true
          example: PERMISSION_DENIED
        message:
          type: string
          nullable: true
          example: The caller does not have permission.
        description:
          type: string
          nullable: true
        param:
          type: string
          nullable: true
    ErrorFailureSampleItem:
      type: object
      properties:
        provider:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        status:
          type: integer
          nullable: true
        upstream_error_code:
          type: string
          nullable: true
        upstream_error_message:
          type: string
          nullable: true
        upstream_error_description:
          type: string
          nullable: true
        upstream_error_param:
          type: string
          nullable: true
        upstream_payload_preview:
          type: string
          nullable: true
        retryable:
          type: boolean
          nullable: true
      additionalProperties: true
    ErrorProviderFailureDiagnostics:
      type: object
      properties:
        category:
          type: string
          enum:
            - credentials_not_configured
            - credentials_invalid_or_forbidden
            - provider_access_missing
            - region_or_project_restriction
            - model_unavailable_for_endpoint
            - rate_limited
            - server_error
        hint:
          type: string
        provider:
          type: string
          nullable: true
    ErrorRoutingDiagnostics:
      type: object
      properties:
        filterStages:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              beforeCount:
                type: integer
              afterCount:
                type: integer
              droppedProviders:
                type: array
                items:
                  type: object
                  properties:
                    providerId:
                      type: string
                      nullable: true
                    reason:
                      type: string
                      nullable: true
                  additionalProperties: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderCandidateDiagnostics:
      type: object
      properties:
        totalProviders:
          type: integer
        supportsEndpointCount:
          type: integer
        candidateCount:
          type: integer
        droppedUnsupportedEndpoint:
          type: array
          items:
            type: string
        droppedMissingAdapter:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              endpoint:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderEnablementDiagnostics:
      type: object
      properties:
        capability:
          type: string
        providersBefore:
          type: array
          items:
            type: string
        providersAfter:
          type: array
          items:
            type: string
        dropped:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              reason:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
    SpendRuleScope:
      type: string
      enum:
        - workspace
        - key
        - member
        - department
        - model
        - provider
    SpendBlockLiftReason:
      type: string
      description: >-
        支出拦截被解除的原因：manual（所有者或管理员）、period_reset、below_limit（支出重新低于拦截点，例如提高预算之后）、rule_changed、rule_disabled
        或 rule_deleted。
      enum:
        - manual
        - period_reset
        - below_limit
        - rule_changed
        - rule_disabled
        - rule_deleted
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer 令牌身份验证

````

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