{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Submit an inference request for the authenticated requester. Builds a (paymentAuthorization, job) pair scoped to the configured exchange, publishes both to the requester's PDS, and returns the job/authorization URIs so the caller can poll for a receipt via `dev.cocore.inference.status`.",
      "errors": [
        {
          "description": "The caller is not authenticated.",
          "name": "AuthRequired"
        },
        {
          "description": "The body failed validation.",
          "name": "InvalidRequest"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "maxTokensOut": {
              "minimum": 1,
              "type": "integer"
            },
            "model": {
              "description": "Opaque model identifier honored by the provider.",
              "minLength": 1,
              "type": "string"
            },
            "outputSchema": {
              "description": "Optional JSON Schema to constrain the model output. When present, the published job record carries this schema and the provider passes it to the inference engine as response_format guided decoding. The schema is public (not encrypted) — it describes the output shape, not the input.",
              "properties": {
                "name": {
                  "description": "Schema name (maps to OpenAI response_format.json_schema.name).",
                  "type": "string"
                },
                "schema": {
                  "description": "The actual JSON Schema object that constrains the model output.",
                  "type": "object"
                },
                "strict": {
                  "description": "Whether to enforce strict schema adherence.",
                  "type": "boolean"
                }
              },
              "type": "object"
            },
            "priceCeiling": {
              "description": "Maximum the requester will pay. Integer minor units plus an ISO 4217 / XBT-style currency code.",
              "properties": {
                "amount": {
                  "minimum": 0,
                  "type": "integer"
                },
                "currency": {
                  "minLength": 1,
                  "type": "string"
                }
              },
              "required": [
                "amount",
                "currency"
              ],
              "type": "object"
            },
            "prompt": {
              "minLength": 1,
              "type": "string"
            },
            "toolChoice": {
              "description": "Optional tool choice strategy. 'auto' (default), 'none', or 'required'. Additive.",
              "knownValues": [
                "auto",
                "none",
                "required"
              ],
              "type": "string"
            },
            "toolChoiceFunction": {
              "description": "When toolChoice is 'required', force the model to call this specific function. Maps to OpenAI tool_choice object form. Additive.",
              "maxLength": 256,
              "type": "string"
            },
            "tools": {
              "description": "Optional list of tool/function definitions the model may call. Public (not encrypted). The published job record carries this list and the provider passes it to the inference engine.",
              "items": {
                "properties": {
                  "function": {
                    "properties": {
                      "description": {
                        "maxLength": 4096,
                        "type": "string"
                      },
                      "name": {
                        "maxLength": 256,
                        "type": "string"
                      },
                      "parameters": {
                        "description": "JSON Schema for the function's arguments.",
                        "type": "object"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "type": "object"
                  },
                  "type": {
                    "knownValues": [
                      "function"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "function"
                ],
                "type": "object"
              },
              "maxLength": 128,
              "type": "array"
            }
          },
          "required": [
            "model",
            "prompt",
            "maxTokensOut",
            "priceCeiling"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "authUri": {
              "format": "at-uri",
              "type": "string"
            },
            "inputCommitment": {
              "description": "SHA-256 (lowercase hex) over the input bytes.",
              "type": "string"
            },
            "jobUri": {
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "jobUri",
            "authUri",
            "inputCommitment"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "dev.cocore.inference.submit",
  "lexicon": 1
}
