{
  "openapi": "3.1.0",
  "info": {
    "title": "BlockRun API (account entry point)",
    "version": "1.0.0",
    "description": "BlockRun is the routing and payment layer for AI. One OpenAI-compatible endpoint routes to 100+ LLMs plus image, video, music and speech generation, web search, prediction-market and on-chain data, and multi-chain RPC. This host is the account-balance entry point: authenticate with an API key and pay from a BlockRun account funded by card or wire \u2014 no wallet signature per call. The same services are also sold per call in USDC over x402 at blockrun.ai (Base), sol.blockrun.ai (Solana) and arc.blockrun.ai (Arc).",
    "contact": {
      "email": "hello@blockrun.ai",
      "url": "https://blockrun.ai"
    },
    "termsOfService": "https://blockrun.ai/terms"
  },
  "servers": [
    {
      "url": "https://api.blockrun.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "BlockRun API key from https://user.blockrun.ai/dashboard/keys"
      },
      "googleApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key",
        "description": "BlockRun API key for Gemini native requests"
      }
    },
    "schemas": {
      "OpenAIServiceTier": {
        "type": ["string", "null"],
        "enum": ["auto", "default", "flex", "fast", "priority", null],
        "description": "Processing tier. Fast and priority both opt in on eligible OpenAI models. Use a -fast alias from GET /v1/models to select Fast by model ID. The quote uses the model's published Fast rates, including applicable context and cache-write rates. For a Fast request, a response with fast, priority, or no reported tier is billed at Fast rates. A response with default is billed at Standard rates."
      },
      "ImageComplexity": {
        "type": "string",
        "enum": ["low", "medium", "high"],
        "description": "GPT Image 2.6 only. Controls planning effort. The provider uses high when omitted. Complexity has no separate fee."
      },
      "ImageOutputFormat": {
        "type": "string",
        "enum": ["png", "jpeg", "webp"],
        "default": "png",
        "description": "File format for OpenAI GPT Image models."
      },
      "ImageJobSummary": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "request_id",
          "model",
          "status",
          "result_url",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Account-owned image job ID."
          },
          "object": {
            "type": "string",
            "const": "image.generation.job"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "Creation time in Unix seconds."
          },
          "request_id": {
            "type": "string",
            "description": "Original creation request ID."
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "pending_confirmation",
              "generated",
              "result_pending",
              "settled",
              "failed"
            ],
            "description": "created: admitted/in progress; generated: output saved, settlement pending; result_pending: explicit failure awaiting reservation release; settled: debit and both billing copies confirmed; failed: reservation released; pending_confirmation: outcome unknown."
          },
          "result_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Authenticated saved-result GET URL, available only after settlement."
          },
          "data": {
            "type": "array",
            "description": "Authenticated download URLs after settlement; otherwise empty.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "get_models",
        "summary": "Live model catalog with per-token prices",
        "description": "Live model catalog with per-token prices. Free. No key needed: with no credential this returns list prices. A key that is sent and wrong is 401.",
        "security": [
          {},
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/images/models": {
      "get": {
        "operationId": "get_images_models",
        "summary": "Image/video model catalog with per-call prices",
        "description": "Image/video model catalog with per-call prices. Free. No key needed: with no credential this returns list prices. A key that is sent and wrong is 401.",
        "security": [
          {},
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "get_usage",
        "summary": "One row per request over a window",
        "description": "One row per request over a window. Free. service_tier records the upstream tier when reported. billing_service_tier is fast when Fast rates apply.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/usage.csv": {
      "get": {
        "operationId": "get_usage_csv",
        "summary": "The same rows as a CSV file, whole window",
        "description": "The rows of /v1/usage for the whole window as a downloadable CSV (UTF-8 BOM, CRLF). No paging. Fails rather than serving a partial file when a day cannot be read. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/usage/summary": {
      "get": {
        "operationId": "get_usage_summary",
        "summary": "Totals over a window: per day, model, endpoint, key",
        "description": "Totals over a window: per day, model, endpoint, key. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "get_balance",
        "summary": "Available balance, recorded spend, open reservations",
        "description": "Available balance, recorded spend, open reservations. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/credits": {
      "get": {
        "operationId": "get_credits",
        "summary": "Balance, with OpenRouter's GET /credits body",
        "description": "Same answer as /v1/balance, plus `data: { total_credits, total_usage }` in OpenRouter's shape; `total_credits - total_usage` is the remaining balance. `total_credits` is null on an account with no ceiling and 0 on an unfunded prepaid account. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/key": {
      "get": {
        "operationId": "get_key",
        "summary": "This key, in OpenRouter's GET /key shape",
        "description": "OpenRouter-compatible: `data.usage`, `usage_daily`, `usage_weekly` (UTC, Monday start) and `usage_monthly` are this key's spend; `limit` / `limit_remaining` are the account's (null when unbounded, 0 for an unfunded prepaid account); `budgets` lists the daily spend cap and the balance. Alias: /v1/auth/key. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        }
      }
    },
    "/v1/activity": {
      "get": {
        "operationId": "get_activity",
        "summary": "Daily spend per model, in OpenRouter's GET /activity shape",
        "description": "OpenRouter-compatible: one row per UTC day, model and endpoint for the last 30 completed UTC days (today excluded). Optional `date` (YYYY-MM-DD) and `api_key_hash` (SHA-256 hex of a key on this account). Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid date, or an unsupported filter (user_id, workspace_id, group_by)"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "No key with that api_key_hash on this account"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        },
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "api_key_hash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/generation": {
      "get": {
        "operationId": "get_generation",
        "summary": "One call's cost and tokens, in OpenRouter's GET /generation shape",
        "description": "OpenRouter-compatible. `id` is the response body's `id` or the `x-blockrun-request-id` header. Looks back 2 UTC days (at most 20,000 calls); a call is readable a few seconds after it completes. At most 60 lookups per minute per account. Use /v1/usage for older calls. Free.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Missing id"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found in the lookup window"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "post_chat_completions",
        "summary": "OpenAI Chat Completions for every model; streaming and tools",
        "description": "OpenAI Chat Completions for every model; streaming and tools. Billed per token from the account balance. Use Fast on an eligible OpenAI model with service_tier set to fast or priority, or by naming a -fast alias from GET /v1/models. For Fast requests the default output cap is 8192, limited by the model and available context. Accounts with a credit ceiling fund the full quote before inference. anthropic/claude-fable-5.2: Anthropic keeps requests for 30 days (not available under zero data retention); never answered by another model; 503 MODEL_UNAVAILABLE before any charge when it is switched off.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid request. Fast requests are refused before payment for unsupported models, input above the Fast limit, accounts with a fixed rate for the model, or conflicting tiers on the Fast alias."
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          },
          "503": {
            "description": "Model temporarily unavailable (code MODEL_UNAVAILABLE); refused before any charge"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "service_tier": {
                    "$ref": "#/components/schemas/OpenAIServiceTier"
                  }
                }
              },
              "example": {
                "model": "openai/gpt-4.1-mini",
                "messages": [
                  {
                    "role": "user",
                    "content": "hello"
                  }
                ]
              }
            }
          }
        },
        "x-billing": {
          "unit": "per token",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/models/{model}:generateContent": {
      "post": {
        "operationId": "gemini_generateContent",
        "summary": "Gemini native content generation with long decode",
        "description": "One native REST hop. Preserves the upstream JSON, including candidates[].finishReason CONTINUATION and candidates[].continuationToken. Resend the original request with top-level continuationToken to continue. Each hop is billed from native usageMetadata, including thinking, tool-use prompt and cached tokens, and retains all usage metadata for billing audits. Tools: functionDeclarations, codeExecution, urlContext only; Search/Maps grounding, File Search, MCP, computer use and non-standard serviceTier are refused (400).",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "googleApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "gemini-4-argon"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              },
              "example": {
                "contents": [
                  {
                    "role": "user",
                    "parts": [
                      {
                        "text": "Prove the theorem."
                      }
                    ]
                  }
                ],
                "generationConfig": {
                  "maxOutputTokens": 262144
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Native GenerateContentResponse; CONTINUATION is a successful, billable hop"
          },
          "400": {
            "description": "Invalid request or unpriceable model"
          },
          "401": {
            "description": "Missing or invalid BlockRun API key"
          },
          "402": {
            "description": "Insufficient account balance"
          },
          "429": {
            "description": "Rate limited"
          }
        },
        "x-billing": {
          "unit": "per token per hop",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "post_messages",
        "summary": "Anthropic Messages, native envelopes",
        "description": "Anthropic Messages, native envelopes. Billed per token from the account balance. claude-fable-5-2: Anthropic keeps requests for 30 days (not available under zero data retention); never answered by another model; 503 MODEL_UNAVAILABLE before any charge when it is switched off; fallbacks, the server-side-fallback beta and fast mode are refused with 400 before any charge.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          },
          "503": {
            "description": "Model temporarily unavailable (code MODEL_UNAVAILABLE); refused before any charge"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-billing": {
          "unit": "per token",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "post_responses",
        "summary": "OpenAI Responses API",
        "description": "OpenAI Responses API. Billed per token from the account balance. For foreground requests with an eligible OpenAI model, set service_tier to fast or priority, or name a -fast alias from GET /v1/models. Fast defaults to an output cap of 32768 tokens, subject to the model limit. Accounts with a credit ceiling fund the full quote before inference.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid request. Fast requests are refused before payment for unsupported models, input above the Fast limit, accounts with a fixed rate for the model, background mode, or conflicting tiers on the Fast alias. Cache TTLs other than 30m are refused for both the request default and explicit content breakpoints. Unpriced server tools return unsupported_server_tool before payment."
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "service_tier": {
                    "$ref": "#/components/schemas/OpenAIServiceTier"
                  }
                }
              },
              "example": {
                "model": "openai/gpt-6-luna",
                "input": "Hello",
                "service_tier": "fast"
              }
            }
          }
        },
        "x-billing": {
          "unit": "per token",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/api/media/image-jobs/{job_id}/{image_index}": {
      "get": {
        "operationId": "get_image_job_download",
        "summary": "Download an account-owned image",
        "description": "Requires a valid API key whose account ID and job ID match the existing BigQuery billing record, plus a confirmed job debit receipt. Private, no-store caching. Paid downloads work at zero or negative balance. Portal cookies alone do not authorize this endpoint.",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "image_index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image bytes from the paid job",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Account or source address access restricted"
          },
          "404": {
            "description": "Result unavailable to this account"
          },
          "429": {
            "description": "Authentication attempts rate limited"
          },
          "503": {
            "description": "Image storage temporarily unavailable"
          }
        }
      }
    },
    "/v1/images": {
      "get": {
        "operationId": "list_images",
        "summary": "List this account's image requests with cursor pagination",
        "description": "BlockRun extension callable with the OpenAI SDK custom GET method. Requires the owning account API key, permits zero/negative balances, and never generates or settles work. Returns requests recorded by the new image event pipeline; no legacy GCS import. Newest creation first with a stable ID tie-breaker. Pass next_cursor back as cursor; cursor is account-bound. Private/no-store, limited to 60 reads/minute per account per API instance. Downloads require the same account API key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1024
            },
            "description": "Opaque next_cursor from a previous page for this account. Omit for the first page."
          }
        ],
        "responses": {
          "200": {
            "description": "Account-owned image requests. This read has no generation or billing side effects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ImageJobSummary"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Continuation cursor, or null at the end."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit/cursor or caller-supplied account_id."
          },
          "401": {
            "description": "Valid API key required; portal cookies alone are insufficient."
          },
          "403": {
            "description": "Suspended account or disallowed source IP."
          },
          "429": {
            "description": "Image history rate limit exceeded; Retry-After is included."
          },
          "503": {
            "description": "Task index unavailable or an inconsistent task record was detected."
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "post_images_generations",
        "summary": "Image generation",
        "description": "Waits for the provider result, saves the media, settles at the account rate and confirms billing before returning. The model catalog specifies whether a model is billed by actual tokens or by image. Retrieve the saved result with GET /v1/images/generations/{request_id}. Accounts using reservations hold the full quote. Outstanding reservations are released after 24 hours, and a later successful result is billed once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Completed image response after storage and settlement. The response returns URLs or Base64 bytes according to response_format. Private image URLs require the owning account API key."
          },
          "400": {
            "description": "Invalid request or unsupported model option. SVG, GIF, markup and frame options are refused before reservation."
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits."
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          },
          "503": {
            "description": "Media storage, settlement, ownership indexing or billing record is temporarily unavailable."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "prompt"],
                "properties": {
                  "model": { "type": "string", "example": "gpt-image-2.6-flare" },
                  "prompt": { "type": "string" },
                  "size": { "type": "string", "default": "1024x1024" },
                  "n": { "type": "integer", "minimum": 1, "maximum": 10, "default": 1 },
                  "quality": { "type": "string" },
                  "complexity": { "$ref": "#/components/schemas/ImageComplexity" },
                  "output_format": {
                    "anyOf": [
                      { "$ref": "#/components/schemas/ImageOutputFormat" },
                      { "type": "null" }
                    ]
                  },
                  "response_format": { "type": "string", "enum": ["url", "b64_json"], "default": "url" }
                }
              }
            }
          }
        },
        "x-billing": {
          "unit": "model-specific",
          "description": "Models with billing_mode per_token settle by actual token usage. Models with billing_mode per_image are billed by image.",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/images/models"
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "operationId": "post_images_edits",
        "summary": "Edit a source image",
        "description": "Waits for the provider result, saves the media, settles actual usage at the account rate and confirms the billing record before returning the final image response and HTTP status. The result id is the original server-generated request_id. Retrieve it with GET /v1/images/generations/{request_id}. An edit retried with the same Idempotency-Key reuses the first request and its result. Historical image IDs are accepted for retrieval. Accounts using reservations hold the full quote before generation; a refusal states the required and available amounts. Outstanding reservations are released after 24 hours without declaring generation failed; a later successful result is billed once at actual usage.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Reuse with the same request parameters to look up the original edit job."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "gpt-image-2.6-flare"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string",
                    "format": "binary"
                  },
                  "image[]": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    },
                    "maxItems": 16,
                    "description": "GPT Image allows 16 source images. Other models have lower limits."
                  },
                  "mask": {
                    "type": "string",
                    "format": "binary"
                  },
                  "size": {
                    "type": "string"
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "quality": {
                    "type": "string"
                  },
                  "complexity": {
                    "$ref": "#/components/schemas/ImageComplexity"
                  },
                  "output_format": {
                    "$ref": "#/components/schemas/ImageOutputFormat"
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "opaque",
                      "transparent"
                    ]
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "image"
                    ]
                  },
                  {
                    "required": [
                      "image[]"
                    ]
                  }
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "description": "Send image as a Base64 data URL or an array of data URLs, or use images with image_url data URL references.",
                "properties": {
                  "complexity": {
                    "$ref": "#/components/schemas/ImageComplexity"
                  },
                  "output_format": {
                    "$ref": "#/components/schemas/ImageOutputFormat"
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "opaque",
                      "transparent"
                    ]
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "image"
                    ]
                  },
                  {
                    "required": [
                      "images"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed image response, after storage and settlement. GPT Image edits may return b64_json. When private image storage is enabled, image URLs use /api/media/image-jobs and require the owning account API key."
          },
          "400": {
            "description": "Invalid request, input image, or model option"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient balance or spending limit. If an edit already exists, the body includes poll_url for retrying settlement."
          },
          "403": {
            "description": "Account suspended"
          },
          "409": {
            "description": "Idempotency key used with different parameters, a failed job or a previously paid result that expired."
          },
          "413": {
            "description": "Request body exceeds 8 MiB"
          },
          "422": {
            "description": "The provider did not return an image"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "502": {
            "description": "Upstream failure or invalid image result"
          },
          "504": {
            "description": "The upstream request timed out"
          },
          "503": {
            "description": "Media storage, settlement, ownership indexing or billing record is temporarily unavailable."
          }
        }
      }
    },
    "/v1/videos/generations": {
      "post": {
        "operationId": "post_videos_generations",
        "summary": "Video generation; returns a poll_url to use verbatim",
        "description": "Video generation; returns a poll_url to use verbatim. Billed per second from the account balance; reference video/audio clips add a per-clip surcharge.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "400": {
            "description": "Invalid request, or an input the model does not support (for example reference video/audio on a model without it)"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          },
          "503": {
            "description": "Reference-to-video temporarily disabled by the operator; Retry-After set. Existing jobs stay pollable."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-billing": {
          "unit": "per second",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "operationId": "post_audio_speech",
        "summary": "Text to speech",
        "description": "Text to speech. Billed per character from the account balance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-billing": {
          "unit": "per character",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/search": {
      "post": {
        "operationId": "post_search",
        "summary": "Live web / news / X search",
        "description": "Live web / news / X search. Billed flat per call from the account balance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-billing": {
          "unit": "flat per call",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models"
        }
      }
    },
    "/v1/stocks/us/price/{symbol}": {
      "get": {
        "operationId": "get_onchain_us_stock_price",
        "summary": "US stock price from on-chain DEX pools (Base)",
        "description": "US stock price from on-chain DEX pools of Coinbase Tokenized Stocks on Base (Aerodrome Slipstream and Uniswap v3 USDC pools): liquidity-weighted, adjusted for the token's dividend multiplier. It is the token's price on Base, not a NASDAQ quote; the response carries the pools, liquidity, multiplier, read time and US market session. $0.005 per call from the account balance. A ticker with no on-chain market answers 404 and a failed read or no qualifying pool answers 503; neither is charged. GET /v1/stocks/us/list?covered=true lists the covered tickers at no charge.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "US ticker, e.g. NVDA. NVDAc and BRK.B are accepted."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "404": {
            "description": "No on-chain market for this ticker on Base (not charged)"
          },
          "429": {
            "description": "Rate limited; Retry-After set"
          },
          "503": {
            "description": "Chain read failed or no qualifying pool right now (not charged)"
          }
        },
        "x-billing": {
          "unit": "flat per call",
          "price": "$0.005",
          "source": "account balance"
        }
      }
    },
    "/v1/decisions": {
      "post": {
        "operationId": "post_decisions",
        "summary": "Typed judgments for agents (OpenAI Decisions API compatible)",
        "description": "Answers typed questions about an input instead of generating text: `predicate` (probability it is true), `choice` (one of your values, with per-option probabilities and a confidence), `score` (probability-weighted position on your ordered levels, with per-level probabilities and a confidence); an answer may also be `type: \"refusal\"`. The request and response are the OpenAI Decisions API contract unchanged, so the OpenAI SDK works with base_url `https://api.blockrun.ai/v1`. `model` defaults to `gpt-6-luna`, the only model. Billed from credit on the input tokens OpenAI reports, at the gpt-6-luna input price ($0.10 per million) plus your account margin. A timeout is charged the hold (64,000 input tokens at that price, plus margin). A 200 whose usage cannot be read is also charged the hold. Your own 4xx, an OpenAI 4xx or 5xx, and a call that never reaches OpenAI are not charged. No refunds. Set `model` to `gemini-decision-1` (or `google/gemini-decision-1`) for Google's Gemini Decision 1: same shape, $0.10 per million input tokens plus margin, hold = the request's estimate up to 262,144 tokens, 15 s timeout, safety-blocked input answers 400 `content_blocked` and is not charged.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "input",
                  "questions"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "default": "gpt-6-luna",
                    "enum": [
                      "gpt-6-luna",
                      "openai/gpt-6-luna"
                    ]
                  },
                  "input": {
                    "description": "A string, or messages `[{role, content}]` whose content carries text and inline base64 images (no image URLs). At most 120,000 characters of text and 8 images per call.",
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  },
                  "questions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "name",
                        "instructions"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "predicate",
                            "choice",
                            "score"
                          ]
                        },
                        "name": {
                          "type": "string",
                          "description": "Your id for the question; the answer carries it back."
                        },
                        "instructions": {
                          "type": "string"
                        },
                        "choices": {
                          "type": "array",
                          "description": "choice only.",
                          "items": {
                            "type": "object",
                            "required": [
                              "value",
                              "description"
                            ],
                            "properties": {
                              "value": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              }
                            }
                          },
                          "maxItems": 255
                        },
                        "levels": {
                          "type": "array",
                          "description": "score only; ordered, indexed from 0.",
                          "items": {
                            "type": "object",
                            "required": [
                              "label",
                              "description"
                            ],
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              }
                            }
                          },
                          "maxItems": 255
                        }
                      }
                    },
                    "maxItems": 64,
                    "description": "At most 64 questions and 30,000 characters in all (measured over the whole array, every field), with at most 255 choices or levels each."
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Forwarded as is."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`{model, answers:[{type, name, probability} | {type, name, choice, probabilities, confidence} | {type, name, score, probabilities, confidence} | {type:\"refusal\", ...}], usage}`",
            "headers": {
              "x-blockrun-backend": {
                "schema": {
                  "type": "string"
                },
                "description": "The model that answered."
              },
              "x-ratelimit-remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Calls left in the hourly quota. No quota is set today, so the value is very large."
              }
            }
          },
          "400": {
            "description": "Invalid request: over a cap (input text 120,000 chars, 8 images, 64 questions, 30,000 chars of questions, 255 choices or levels), or a model other than gpt-6-luna (refused before anything runs), or relayed verbatim from the model's validation. Not charged."
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance, credit limit or daily spend cap reached \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "403": {
            "description": "Account suspended, or caller address outside the account's IP allowlist"
          },
          "413": {
            "description": "Body over 10 MB"
          },
          "429": {
            "description": "Hourly quota spent, when one is set on this host (shared by /v1/decisions and /v1/decide); Retry-After set"
          },
          "502": {
            "description": "Upstream error, or OpenAI could not be reached. Not charged."
          },
          "503": {
            "description": "Decisions is not configured on this host"
          },
          "504": {
            "description": "Upstream timed out after 30 seconds. Charged the hold: 64,000 input tokens at the gpt-6-luna input price, plus your margin. OpenAI may have done the work."
          }
        },
        "x-billing": {
          "unit": "per input token",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models",
          "note": "The gpt-6-luna input price ($0.10 per million input tokens) plus your account margin. No output charge. A prepaid account with no balance gets 402. No hourly quota is set; your balance is the limit. A timeout is charged the hold. No refunds."
        }
      }
    },
    "/v1/decide": {
      "post": {
        "operationId": "post_decide",
        "summary": "Typed judgments in System One's wire format (alias of /v1/decisions)",
        "description": "Kept for callers built against System One's wire format: `state` (string or JSON object) plus `questions` keyed by your ids, of type `noul` (yes/no with a probability), `choice` (`criteria` = {label: description}) or `score` (`criteria` = ordered array). Translated to /v1/decisions and answered in the same shape, by the same model. A refusal is returned as `{type: \"refusal\", ...}` under your id. New integrations should use /v1/decisions. Billed exactly like /v1/decisions: input tokens at the gpt-6-luna input price plus your account margin. One extra case: an OpenAI answer that cannot be turned into this shape returns 502 and is charged its input tokens. Always served by gpt-6-luna.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "state",
                  "questions"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Ignored; the call is answered by `gpt-6-luna`. Accepted so existing bodies still validate."
                  },
                  "state": {
                    "description": "The thing to judge: a string, or a JSON object.",
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object"
                      }
                    ]
                  },
                  "questions": {
                    "type": "object",
                    "description": "Question id \u2192 question.",
                    "additionalProperties": {
                      "type": "object",
                      "required": [
                        "type",
                        "instructions"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "noul",
                            "choice",
                            "score"
                          ]
                        },
                        "instructions": {
                          "type": "string"
                        },
                        "criteria": {
                          "description": "noul: {\"true\": \u2026, \"false\": \u2026}; choice: {label: description}; score: ordered array of level descriptions.",
                          "oneOf": [
                            {
                              "type": "object"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`{model, answers:{id: {noul} | {choice, probabilities, confidence} | {score, legend, probabilities, confidence} | {type:\"refusal\", ...}}, usage}`",
            "headers": {
              "x-blockrun-backend": {
                "schema": {
                  "type": "string"
                },
                "description": "The model that answered."
              },
              "x-ratelimit-remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Calls left in the hourly quota. No quota is set today, so the value is very large."
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Insufficient account balance, credit limit or daily spend cap reached \u2014 add credit at https://user.blockrun.ai/dashboard/credits"
          },
          "403": {
            "description": "Account suspended, or caller address outside the account's IP allowlist"
          },
          "413": {
            "description": "Body over 200 KB"
          },
          "422": {
            "description": "Not a valid System One body (same messages as before); not charged"
          },
          "429": {
            "description": "Hourly quota spent, when one is set on this host (shared by /v1/decisions and /v1/decide); Retry-After set"
          },
          "502": {
            "description": "Upstream error, or OpenAI could not be reached: not charged. An OpenAI answer that cannot be turned into this shape: charged its input tokens."
          },
          "503": {
            "description": "Decisions is not configured on this host"
          },
          "504": {
            "description": "Upstream timed out after 30 seconds. Charged the hold: 64,000 input tokens at the gpt-6-luna input price, plus your margin. OpenAI may have done the work."
          }
        },
        "x-billing": {
          "unit": "per input token",
          "source": "account balance",
          "priceSheet": "https://api.blockrun.ai/v1/models",
          "note": "The gpt-6-luna input price ($0.10 per million input tokens) plus your account margin. No output charge. A prepaid account with no balance gets 402. No hourly quota is set; your balance is the limit. A timeout is charged the hold. No refunds."
        }
      }
    }
  },
  "externalDocs": {
    "url": "https://api.blockrun.ai/llms.txt",
    "description": "Agent-readable reference"
  }
}
