{
 "openapi": "3.1.0",
 "info": {
  "title": "alallo API",
  "version": "1",
  "description": "Fine-tune open language models: upload data, pick a model, get a fixed price per training token before you start, and download the trained model. Authenticate with an API key made in Profile > API keys (Authorization: Bearer alk_...). Keys have a monthly spending cap; only a person can add credit, in the dashboard."
 },
 "servers": [
  {
   "url": "https://alallo.com",
   "description": "EU (prices in EUR)"
  },
  {
   "url": "https://us.alallo.com",
   "description": "US (prices in USD)"
  }
 ],
 "security": [
  {
   "apiKey": []
  }
 ],
 "paths": {
  "/v1/account/balance": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Credit available and held by running jobs",
    "operationId": "get_v1_account_balance"
   }
  },
  "/v1/account/billing": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Purchases and job usage",
    "operationId": "get_v1_account_billing"
   }
  },
  "/v1/account/keys": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Your API keys (sign-in only, not with a key)",
    "operationId": "get_v1_account_keys",
    "security": [
     {
      "signIn": []
     }
    ]
   },
   "post": {
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/KeyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Make an API key; its secret is shown once (sign-in only)",
    "operationId": "post_v1_account_keys",
    "security": [
     {
      "signIn": []
     }
    ]
   }
  },
  "/v1/account/keys/{key_id}": {
   "delete": {
    "parameters": [
     {
      "name": "key_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Key Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Revoke an API key (sign-in only)",
    "operationId": "delete_v1_account_keys_key_id",
    "security": [
     {
      "signIn": []
     }
    ]
   }
  },
  "/v1/account/me": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Who the key or sign-in acts as",
    "operationId": "get_v1_account_me"
   }
  },
  "/v1/algorithms": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Training methods and their settings",
    "operationId": "get_v1_algorithms"
   }
  },
  "/v1/basemodels": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Your uploaded base models",
    "operationId": "get_v1_basemodels"
   }
  },
  "/v1/datasets": {
   "post": {
    "parameters": [
     {
      "name": "filename",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Filename"
      }
     }
    ],
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Upload a small training file in the request body (up to 10 MB)",
    "operationId": "post_v1_datasets"
   },
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Your uploaded training files",
    "operationId": "get_v1_datasets"
   }
  },
  "/v1/datasets/upload-url": {
   "post": {
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "additionalProperties": true,
        "type": "object",
        "title": "Body"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Get an address to PUT a training file to",
    "operationId": "post_v1_datasets_upload_url"
   }
  },
  "/v1/datasets/{dataset_id}/check": {
   "post": {
    "parameters": [
     {
      "name": "dataset_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Dataset Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Check an uploaded file (202 while a large one is being checked)",
    "operationId": "post_v1_datasets_dataset_id_check"
   }
  },
  "/v1/estimate": {
   "post": {
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PlanRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Price and time range for a job on your data (202 while the data is read)",
    "operationId": "post_v1_estimate"
   }
  },
  "/v1/jobs": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Your account's jobs",
    "operationId": "get_v1_jobs"
   },
   "post": {
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SubmitRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "201": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Start a job (confirm: true; billed from your credit)",
    "operationId": "post_v1_jobs",
    "description": "API keys need scope jobs."
   }
  },
  "/v1/jobs/{job_id}": {
   "get": {
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "A job's status, progress, price and time left",
    "operationId": "get_v1_jobs_job_id"
   }
  },
  "/v1/jobs/{job_id}/cancel": {
   "post": {
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Cancel a job",
    "operationId": "post_v1_jobs_job_id_cancel",
    "description": "API keys need scope jobs."
   }
  },
  "/v1/jobs/{job_id}/evaluation": {
   "get": {
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "A job's evaluation report",
    "operationId": "get_v1_jobs_job_id_evaluation"
   }
  },
  "/v1/jobs/{job_id}/logs": {
   "get": {
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Job Id"
      }
     },
     {
      "name": "tail",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 200,
       "title": "Tail"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "A job's training log",
    "operationId": "get_v1_jobs_job_id_logs"
   }
  },
  "/v1/jobs/{job_id}/output": {
   "get": {
    "parameters": [
     {
      "name": "job_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Job Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Download links for the trained model, and how long it is kept",
    "operationId": "get_v1_jobs_job_id_output"
   }
  },
  "/v1/models": {
   "get": {
    "parameters": [
     {
      "name": "residency",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Residency"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Base models you can fine-tune now",
    "operationId": "get_v1_models"
   }
  },
  "/v1/models/check": {
   "get": {
    "parameters": [
     {
      "name": "model",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Model"
      }
     },
     {
      "name": "residency",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Residency"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Whether a model (e.g. a Hugging Face id) can be trained",
    "operationId": "get_v1_models_check"
   }
  },
  "/v1/public/algorithms": {
   "get": {
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     }
    },
    "summary": "Training methods (no sign-in)",
    "operationId": "get_v1_public_algorithms",
    "security": []
   }
  },
  "/v1/public/estimate": {
   "post": {
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublicEstimateRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Approximate price and time without an account or data",
    "operationId": "post_v1_public_estimate",
    "security": []
   }
  },
  "/v1/public/models": {
   "get": {
    "parameters": [
     {
      "name": "residency",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Residency"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Base models (no sign-in)",
    "operationId": "get_v1_public_models",
    "security": []
   }
  },
  "/v1/public/models/check": {
   "get": {
    "parameters": [
     {
      "name": "model",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Model"
      }
     },
     {
      "name": "residency",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Residency"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "summary": "Whether a model can be trained (no sign-in)",
    "operationId": "get_v1_public_models_check",
    "security": []
   }
  }
 },
 "components": {
  "schemas": {
   "HTTPValidationError": {
    "properties": {
     "detail": {
      "items": {
       "$ref": "#/components/schemas/ValidationError"
      },
      "type": "array",
      "title": "Detail"
     }
    },
    "type": "object",
    "title": "HTTPValidationError"
   },
   "KeyRequest": {
    "properties": {
     "name": {
      "type": "string",
      "title": "Name"
     },
     "scope": {
      "type": "string",
      "title": "Scope",
      "default": "quote"
     },
     "monthly_cap": {
      "anyOf": [
       {
        "type": "number"
       },
       {
        "type": "null"
       }
      ],
      "title": "Monthly Cap"
     }
    },
    "type": "object",
    "required": [
     "name"
    ],
    "title": "KeyRequest"
   },
   "PlanRequest": {
    "properties": {
     "spec": {
      "additionalProperties": true,
      "type": "object",
      "title": "Spec"
     }
    },
    "type": "object",
    "required": [
     "spec"
    ],
    "title": "PlanRequest"
   },
   "PublicEstimateRequest": {
    "properties": {
     "model": {
      "type": "string",
      "title": "Model"
     },
     "algorithm": {
      "type": "string",
      "title": "Algorithm",
      "default": "sft-lora"
     },
     "epochs": {
      "type": "number",
      "maximum": 100.0,
      "exclusiveMinimum": 0.0,
      "title": "Epochs",
      "default": 1.0
     },
     "objective": {
      "type": "string",
      "title": "Objective",
      "default": "cost"
     },
     "residency": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Residency"
     },
     "training_tokens": {
      "anyOf": [
       {
        "type": "integer",
        "exclusiveMinimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Training Tokens"
     },
     "dataset_tokens": {
      "anyOf": [
       {
        "type": "integer",
        "exclusiveMinimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Dataset Tokens"
     },
     "examples": {
      "anyOf": [
       {
        "type": "integer",
        "exclusiveMinimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Examples"
     },
     "avg_chars": {
      "anyOf": [
       {
        "type": "integer",
        "exclusiveMinimum": 0.0
       },
       {
        "type": "null"
       }
      ],
      "title": "Avg Chars"
     },
     "params": {
      "anyOf": [
       {
        "additionalProperties": true,
        "type": "object"
       },
       {
        "type": "null"
       }
      ],
      "title": "Params"
     }
    },
    "type": "object",
    "required": [
     "model"
    ],
    "title": "PublicEstimateRequest"
   },
   "SubmitRequest": {
    "properties": {
     "spec": {
      "additionalProperties": true,
      "type": "object",
      "title": "Spec"
     },
     "confirm": {
      "type": "boolean",
      "title": "Confirm",
      "default": false
     }
    },
    "type": "object",
    "required": [
     "spec"
    ],
    "title": "SubmitRequest"
   },
   "ValidationError": {
    "properties": {
     "loc": {
      "items": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "integer"
        }
       ]
      },
      "type": "array",
      "title": "Location"
     },
     "msg": {
      "type": "string",
      "title": "Message"
     },
     "type": {
      "type": "string",
      "title": "Error Type"
     },
     "input": {
      "title": "Input"
     },
     "ctx": {
      "type": "object",
      "title": "Context"
     }
    },
    "type": "object",
    "required": [
     "loc",
     "msg",
     "type"
    ],
    "title": "ValidationError"
   }
  },
  "securitySchemes": {
   "apiKey": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "alk_...",
    "description": "An alallo API key (Profile > API keys)."
   },
   "signIn": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "JWT",
    "description": "A person's dashboard sign-in."
   }
  }
 }
}
