{"openapi":"3.1.0","info":{"title":"Kojen API","version":"1.0.0","description":"Kojen, the AI training dojo, for agents. Authenticate with `Authorization: Bearer kojen_…` (create keys under Settings → API keys). Every request runs as the key's owner. The same tools are available over MCP at /api/mcp."},"servers":[{"url":"https://kojen.ai/api/v1"}],"security":[{"apiKey":[]}],"paths":{"/projects":{"get":{"tags":["projects"],"summary":"List projects","description":"ML projects: the top-level container for datasets, training runs, evaluations and deployments.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","training","evaluating","deployed","archived"]}},{"name":"model_type","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Projects"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["projects"],"summary":"Create projects","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Projects"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/projects/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["projects"],"summary":"Get one of projects","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Projects"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["projects"],"summary":"Update one of projects","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Projects"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["projects"],"summary":"Delete one of projects","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/datasets":{"get":{"tags":["datasets"],"summary":"List datasets","description":"Training datasets (CSV, JSON, JSONL). Create one with data via POST /datasets/import ({name, rows | csv, project_id?}) or upload files in the web app; row_count and column_count are measured from the file. POST /datasets/{id}/profile re-reads it (counts, columns, preview, test-set suitability). Datasets with input/expected-style columns can be used as test sets.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["uploading","processing","ready","error"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Datasets"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["datasets"],"summary":"Create datasets","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Datasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/datasets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["datasets"],"summary":"Get one of datasets","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Datasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["datasets"],"summary":"Update one of datasets","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Datasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["datasets"],"summary":"Delete one of datasets","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/datasets/{id}/profile":{"post":{"tags":["datasets"],"summary":"profile datasets","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"save":{"default":true,"type":"boolean"}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/training-pipelines":{"get":{"tags":["training-pipelines"],"summary":"List training-pipelines","description":"Training runs (Forge). Create one, then POST /training-pipelines/{id}/start. prompt_tuning and automl are real (judge-scored on test cases; config: base_model, dataset_id, cases, rounds, candidates, models) and save a model version to the project; audio_lora is real GPU training on a ZIP of audio (limited access; config: dataset_id, rights_confirmed, epochs, rank, sample_prompts) and saves a draft model version; lora, finetune and rlhf are previews with simulated metrics (metrics.simulated=true). Results appear in metrics as the run progresses.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","queued","running","completed","failed"]}},{"name":"pipeline_type","in":"query","schema":{"type":"string","enum":["automl","finetune","rlhf","prompt_tuning","lora","audio_lora"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrainingPipelines"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["training-pipelines"],"summary":"Create training-pipelines","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingPipelinesInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrainingPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/training-pipelines/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["training-pipelines"],"summary":"Get one of training-pipelines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrainingPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["training-pipelines"],"summary":"Update one of training-pipelines","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingPipelinesInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrainingPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["training-pipelines"],"summary":"Delete one of training-pipelines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/training-pipelines/{id}/start":{"post":{"tags":["training-pipelines"],"summary":"start training-pipelines","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TrainingPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/evaluations":{"get":{"tags":["evaluations"],"summary":"List evaluations","description":"Model evaluations (accuracy, hallucination, bias, custom, comprehensive), run for real with an LLM judge. config: {model | model_version_id | deployment_id, dataset_id?, cases? (default 12, max 50), criteria? (custom)}. Create, then POST /evaluations/{id}/run; results hold per-case verdicts, measured latency and a 0-100 trust score.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"pipeline_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","running","completed","failed"]}},{"name":"eval_type","in":"query","schema":{"type":"string","enum":["accuracy","hallucination","bias","custom","comprehensive"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Evaluations"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["evaluations"],"summary":"Create evaluations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluationsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Evaluations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/evaluations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["evaluations"],"summary":"Get one of evaluations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Evaluations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["evaluations"],"summary":"Update one of evaluations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluationsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Evaluations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["evaluations"],"summary":"Delete one of evaluations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/evaluations/{id}/run":{"post":{"tags":["evaluations"],"summary":"run evaluations","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Evaluations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/simulations":{"get":{"tags":["simulations"],"summary":"List simulations","description":"Real simulations: synthetic data generation (saved as a dataset), adversarial red-teaming, stress tests (measured latency/throughput) and scenario tests. config picks the target (deployment_id | model_version_id | model | project_id) and type settings. POST /simulations/{id}/run to execute; results hold the full logs.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"simulation_type","in":"query","schema":{"type":"string","enum":["synthetic_data","adversarial","stress_test","scenario"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Simulations"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["simulations"],"summary":"Create simulations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulationsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Simulations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/simulations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["simulations"],"summary":"Get one of simulations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Simulations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["simulations"],"summary":"Update one of simulations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulationsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Simulations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["simulations"],"summary":"Delete one of simulations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/simulations/{id}/run":{"post":{"tags":["simulations"],"summary":"run simulations","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Simulations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/synthetic-datasets":{"get":{"tags":["synthetic-datasets"],"summary":"List synthetic-datasets","description":"Datasets produced by synthetic_data simulations. schema_def holds {columns, dataset_id}; the rows live in the linked datasets record.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"simulation_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SyntheticDatasets"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["synthetic-datasets"],"summary":"Create synthetic-datasets","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyntheticDatasetsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SyntheticDatasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/synthetic-datasets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["synthetic-datasets"],"summary":"Get one of synthetic-datasets","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SyntheticDatasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["synthetic-datasets"],"summary":"Update one of synthetic-datasets","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyntheticDatasetsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SyntheticDatasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["synthetic-datasets"],"summary":"Delete one of synthetic-datasets","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/model-versions":{"get":{"tags":["model-versions"],"summary":"List model-versions","description":"Versioned models for a project. Real training runs add one (status active) with config_snapshot {model, system_prompt, pipeline_id, method} and measured metrics {accuracy, holdout_accuracy, avg_latency_ms, cases, source}. Evaluations and deployments can target a version. One version per project is active (used when no model is given); POST /model-versions/{id}/activate switches it.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","active","archived"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModelVersions"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["model-versions"],"summary":"Create model-versions","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVersionsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVersions"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/model-versions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["model-versions"],"summary":"Get one of model-versions","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVersions"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["model-versions"],"summary":"Update one of model-versions","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVersionsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVersions"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["model-versions"],"summary":"Delete one of model-versions","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/model-versions/{id}/activate":{"post":{"tags":["model-versions"],"summary":"activate model-versions","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployments":{"get":{"tags":["deployments"],"summary":"List deployments","description":"Model endpoints. Create with config {model, system_prompt} or model_version_id, then POST /deployments/{id}/deploy (a real smoke-test call; failures set status failed + config.last_error). endpoint_url is a live OpenAI-compatible POST …/chat/completions (Bearer kojen_ API key); POST /api/v1/endpoints/{id}/feedback records feedback. /start and /stop gate serving. metrics/health are computed from deployment_metrics; config.auto_retrain {enabled, error_rate_threshold, negative_feedback_threshold} starts prompt-tuning runs.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["deploying","active","stopped","failed"]}},{"name":"environment","in":"query","schema":{"type":"string","enum":["staging","production"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Deployments"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["deployments"],"summary":"Create deployments","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployments/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["deployments"],"summary":"Get one of deployments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["deployments"],"summary":"Update one of deployments","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["deployments"],"summary":"Delete one of deployments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployments/{id}/deploy":{"post":{"tags":["deployments"],"summary":"deploy deployments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployments/{id}/start":{"post":{"tags":["deployments"],"summary":"start deployments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployments/{id}/stop":{"post":{"tags":["deployments"],"summary":"stop deployments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deployments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployment-metrics":{"get":{"tags":["deployment-metrics"],"summary":"List deployment-metrics","description":"Per-request metrics recorded by a live deployment endpoint: metric_type latency_ms (value = ms) or error, metadata {prediction_id, model, tokens, input, prediction}. Read-only.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"deployment_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"metric_type","in":"query","schema":{"type":"string"}},{"name":"is_alert","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentMetrics"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/deployment-metrics/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["deployment-metrics"],"summary":"Get one of deployment-metrics","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DeploymentMetrics"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/feedback":{"get":{"tags":["feedback"],"summary":"List feedback","description":"Prediction feedback (positive/negative + optional correction) on deployment responses, usually posted to /api/v1/endpoints/{id}/feedback with a kojen.prediction_id.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"deployment_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"feedback","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Feedback"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["feedback"],"summary":"Create feedback","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Feedback"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/feedback/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["feedback"],"summary":"Get one of feedback","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Feedback"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-tasks":{"get":{"tags":["agent-tasks"],"summary":"List agent-tasks","description":"Real autonomous agent jobs (data_cleaner, researcher, trainer, evaluator, deployer). Create one (or use POST /agent-tasks/dispatch) and POST /agent-tasks/{id}/launch. logs is a live step log [{ts, msg, level}]; output_result holds measured results (and error on failure).","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string","enum":["queued","running","completed","failed","cancelled"]}},{"name":"agent_type","in":"query","schema":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentTasks"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["agent-tasks"],"summary":"Create agent-tasks","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTasksInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-tasks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["agent-tasks"],"summary":"Get one of agent-tasks","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["agent-tasks"],"summary":"Update one of agent-tasks","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTasksInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["agent-tasks"],"summary":"Delete one of agent-tasks","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-tasks/{id}/launch":{"post":{"tags":["agent-tasks"],"summary":"launch agent-tasks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-tasks/{id}/cancel":{"post":{"tags":["agent-tasks"],"summary":"cancel agent-tasks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-pipelines":{"get":{"tags":["agent-pipelines"],"summary":"List agent-pipelines","description":"Orchestrator pipelines: ordered agent steps [{agent_type, name}]. POST /agent-pipelines/{id}/run to execute; each step becomes an agent task (steps[i].task_id, status pending|active|done|failed) and results holds per-step summaries, passed-forward outputs and total_duration_ms.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"project_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentPipelines"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["agent-pipelines"],"summary":"Create agent-pipelines","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPipelinesInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-pipelines/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["agent-pipelines"],"summary":"Get one of agent-pipelines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["agent-pipelines"],"summary":"Update one of agent-pipelines","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPipelinesInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["agent-pipelines"],"summary":"Delete one of agent-pipelines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-pipelines/{id}/run":{"post":{"tags":["agent-pipelines"],"summary":"run agent-pipelines","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentPipelines"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/conversations":{"get":{"tags":["conversations"],"summary":"List conversations","description":"Kojen Agent conversations.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"pinned","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversations"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["conversations"],"summary":"Create conversations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Conversations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/conversations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["conversations"],"summary":"Get one of conversations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Conversations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["conversations"],"summary":"Update one of conversations","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Conversations"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["conversations"],"summary":"Delete one of conversations","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/messages":{"get":{"tags":["messages"],"summary":"List messages","description":"Messages in Kojen Agent conversations.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"conversation_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"role","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Messages"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/messages/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["messages"],"summary":"Get one of messages","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Messages"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/katas":{"get":{"tags":["katas"],"summary":"List katas","description":"Training katas (exercises). Public katas plus your own. POST /katas/{id}/start and /katas/{id}/complete.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"difficulty","in":"query","schema":{"type":"string","enum":["beginner","intermediate","advanced","master"]}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"is_public","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Katas"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["katas"],"summary":"Create katas","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KatasInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Katas"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/katas/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["katas"],"summary":"Get one of katas","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Katas"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["katas"],"summary":"Update one of katas","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KatasInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Katas"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["katas"],"summary":"Delete one of katas","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/katas/{id}/start":{"post":{"tags":["katas"],"summary":"start katas","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Katas"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/katas/{id}/complete":{"post":{"tags":["katas"],"summary":"complete katas","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"submission":{"type":"string","maxLength":20000,"description":"Your work, graded 0-100 by Sensei against the brief"},"score":{"type":"integer","minimum":0,"maximum":100,"description":"Self-measured score"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Katas"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/kata-progress":{"get":{"tags":["kata-progress"],"summary":"List kata-progress","description":"Your progress, attempts and best score per kata.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"kata_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KataProgress"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/kata-progress/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["kata-progress"],"summary":"Get one of kata-progress","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KataProgress"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/templates":{"get":{"tags":["templates"],"summary":"List templates","description":"Use-case templates with recommended dataset, model, eval and deployment config. POST /templates/{id}/use creates a project from one and generates a starter dataset.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"difficulty","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Templates"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/templates/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["templates"],"summary":"Get one of templates","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Templates"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/templates/{id}/use":{"post":{"tags":["templates"],"summary":"use templates","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"description":"Project name (default: template name + date)","type":"string"},"row_count":{"description":"Starter rows (default 50)","type":"integer","minimum":1,"maximum":500}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/marketplace":{"get":{"tags":["marketplace"],"summary":"List marketplace","description":"Model marketplace listings: published listings from everyone plus your own drafts. Publish one by linking model_version_id and setting is_published. POST /marketplace/{id}/import {project_id} copies its model into your project as a draft version; POST /marketplace/{id}/rate {stars: 1-5} rates it.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"is_published","in":"query","schema":{"type":"boolean"}},{"name":"model_type","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Marketplace"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["marketplace"],"summary":"Create marketplace","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketplaceInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Marketplace"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/marketplace/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["marketplace"],"summary":"Get one of marketplace","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Marketplace"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["marketplace"],"summary":"Update one of marketplace","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketplaceInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Marketplace"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["marketplace"],"summary":"Delete one of marketplace","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/marketplace/{id}/import":{"post":{"tags":["marketplace"],"summary":"import marketplace","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"project_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["project_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/marketplace/{id}/rate":{"post":{"tags":["marketplace"],"summary":"rate marketplace","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"stars":{"type":"integer","minimum":1,"maximum":5}},"required":["stars"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/workspaces":{"get":{"tags":["workspaces"],"summary":"List workspaces","description":"Team workspaces you belong to. Creating one makes you its owner. POST /workspaces/{id}/invite {email, role} adds an existing Kojen user.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Workspaces"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["workspaces"],"summary":"Create workspaces","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspacesInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Workspaces"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/workspaces/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["workspaces"],"summary":"Get one of workspaces","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Workspaces"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["workspaces"],"summary":"Update one of workspaces","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspacesInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Workspaces"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["workspaces"],"summary":"Delete one of workspaces","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/workspaces/{id}/invite":{"post":{"tags":["workspaces"],"summary":"invite workspaces","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"default":"member","type":"string","enum":["admin","member","viewer"]}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/workspace-members":{"get":{"tags":["workspace-members"],"summary":"List workspace-members","description":"Members of your workspaces (admins can add, update, remove).","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"workspace_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"role","in":"query","schema":{"type":"string","enum":["owner","admin","member","viewer"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMembers"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["workspace-members"],"summary":"Create workspace-members","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembersInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkspaceMembers"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/workspace-members/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["workspace-members"],"summary":"Get one of workspace-members","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkspaceMembers"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["workspace-members"],"summary":"Update one of workspace-members","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembersInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WorkspaceMembers"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["workspace-members"],"summary":"Delete one of workspace-members","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/comments":{"get":{"tags":["comments"],"summary":"List comments","description":"Comments on projects and other targets.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"target_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"target_type","in":"query","schema":{"type":"string"}},{"name":"parent_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Comments"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["comments"],"summary":"Create comments","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentsInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Comments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/comments/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["comments"],"summary":"Get one of comments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Comments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["comments"],"summary":"Update one of comments","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentsInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Comments"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["comments"],"summary":"Delete one of comments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/preferences":{"get":{"tags":["preferences"],"summary":"List preferences","description":"Key/value preferences, e.g. sensei_tone and sensei_expertise ({ value: ... }).","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"key","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Preferences"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["preferences"],"summary":"Create preferences","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreferencesInput"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Preferences"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/preferences/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["preferences"],"summary":"Get one of preferences","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Preferences"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["preferences"],"summary":"Update one of preferences","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreferencesInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Preferences"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["preferences"],"summary":"Delete one of preferences","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/profiles":{"get":{"tags":["profiles"],"summary":"List profiles","description":"User profiles. Update your own display_name, bio, industry.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"order","in":"query","schema":{"type":"string","example":"created_at.desc"}},{"name":"user_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Profiles"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/profiles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"tags":["profiles"],"summary":"Get one of profiles","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Profiles"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["profiles"],"summary":"Update one of profiles","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfilesInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Profiles"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/me":{"get":{"tags":["account"],"summary":"The caller's user id and profile","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/summary":{"get":{"tags":["account"],"summary":"Workspace counts","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/sensei":{"post":{"tags":["ai"],"summary":"Ask Sensei, the AI training guide","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"enum":["user","assistant"]},"content":{"type":"string"}}}},"mode":{"enum":["chat","intent_to_model"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"answer":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent":{"post":{"tags":["ai"],"summary":"Run the Kojen Agent, which uses every dojo tool on your behalf","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"enum":["user","assistant"]},"content":{"type":"string"}}}},"mode":{"enum":["chat","intent_to_model"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"content":{"type":"string"},"toolEvents":{"type":"array"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/agent-tasks/dispatch":{"post":{"tags":["agent-tasks"],"summary":"Create and launch an agent task in one call","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"agent_type":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"input_config":{"description":"Per agent_type, all optional — data_cleaner: {dataset_id} (default: the project's newest dataset); researcher: {compare (default true), models: [catalog keys]}; trainer: {base_model, dataset_id, cases} (default model: the project's active version); evaluator: {model_version_id | model, dataset_id, cases (default 12), training_pipeline_id}; deployer: {model_version_id | model, environment: staging|production}","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["agent_type","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AgentTasks"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/datasets/import":{"post":{"tags":["datasets"],"summary":"Create a dataset from inline rows or CSV text","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"rows":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"csv":{"type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Datasets"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/models":{"get":{"tags":["models"],"summary":"Model catalog keys accepted wherever a model is chosen","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"gateway_id":{"type":"string"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/endpoints/{id}/chat/completions":{"post":{"tags":["endpoints"],"summary":"Call a deployed model (OpenAI-compatible chat completions)","description":"The deployment's system prompt is prepended. Responses follow the OpenAI chat.completion shape plus `kojen.prediction_id` for feedback. Stopped deployments return 409. Errors use the OpenAI `{ error: { message, type } }` shape.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Deployment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}}}},"temperature":{"type":"number","minimum":0,"maximum":2},"max_tokens":{"type":"integer"}}}}}},"responses":{"200":{"description":"chat.completion"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/endpoints/{id}/feedback":{"post":{"tags":["endpoints"],"summary":"Rate a prediction from a deployment (drives auto-retraining)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Deployment id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prediction_id","feedback"],"properties":{"prediction_id":{"type":"string","description":"kojen.prediction_id of a completion"},"feedback":{"enum":["positive","negative"]},"correction":{"description":"Optional corrected output"}}}}}},"responses":{"200":{"description":"Recorded"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools":{"get":{"tags":["tools"],"summary":"List agent tools (same as the MCP server)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/get_workspace_summary":{"post":{"tags":["tools"],"operationId":"get_workspace_summary","summary":"Counts of the caller's projects, datasets, training runs, evaluations, simulations, deployments, agent tasks and completed katas.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/describe_resources":{"post":{"tags":["tools"],"operationId":"describe_resources","summary":"List every Kojen resource type with its description, filterable columns and allowed values. Call this first to learn the data model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/list_models":{"post":{"tags":["tools"],"operationId":"list_models","summary":"List the model catalog keys accepted wherever a tool takes a model (base_model, model, models): training, evaluations, simulations and deployments. Models are served through the Vercel AI Gateway.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/list_records":{"post":{"tags":["tools"],"operationId":"list_records","summary":"List records of a resource (see describe_resources), newest first. Supports equality filters on the resource's filter columns.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["projects","datasets","training-pipelines","evaluations","simulations","synthetic-datasets","model-versions","deployments","deployment-metrics","feedback","agent-tasks","agent-pipelines","conversations","messages","katas","kata-progress","templates","marketplace","workspaces","workspace-members","comments","preferences","profiles"]},"filters":{"description":"Equality filters, e.g. {\"status\": \"completed\", \"project_id\": \"…\"}","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"limit":{"type":"integer","minimum":1,"maximum":200},"offset":{"type":"integer","minimum":0,"maximum":9007199254740991},"order":{"description":"Sort column, optionally \".desc\", e.g. \"created_at.desc\"","type":"string"}},"required":["resource"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/get_record":{"post":{"tags":["tools"],"operationId":"get_record","summary":"Fetch one record of a resource by id. Run-type records (training, evaluations, simulations, deployments, agent tasks/pipelines) are returned with up-to-date progress.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["projects","datasets","training-pipelines","evaluations","simulations","synthetic-datasets","model-versions","deployments","deployment-metrics","feedback","agent-tasks","agent-pipelines","conversations","messages","katas","kata-progress","templates","marketplace","workspaces","workspace-members","comments","preferences","profiles"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["resource","id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/create_record":{"post":{"tags":["tools"],"operationId":"create_record","summary":"Create a record of any resource. Ownership is set to the caller automatically; server-managed fields are ignored.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["projects","datasets","training-pipelines","evaluations","simulations","synthetic-datasets","model-versions","deployments","deployment-metrics","feedback","agent-tasks","agent-pipelines","conversations","messages","katas","kata-progress","templates","marketplace","workspaces","workspace-members","comments","preferences","profiles"]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["resource","data"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/update_record":{"post":{"tags":["tools"],"operationId":"update_record","summary":"Update fields on a record. Server-managed fields (status, progress, results, …) are ignored; use the run tools instead.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["projects","datasets","training-pipelines","evaluations","simulations","synthetic-datasets","model-versions","deployments","deployment-metrics","feedback","agent-tasks","agent-pipelines","conversations","messages","katas","kata-progress","templates","marketplace","workspaces","workspace-members","comments","preferences","profiles"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["resource","id","data"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/delete_record":{"post":{"tags":["tools"],"operationId":"delete_record","summary":"Permanently delete a record. Confirm with the user before deleting anything they did not ask to delete.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["projects","datasets","training-pipelines","evaluations","simulations","synthetic-datasets","model-versions","deployments","deployment-metrics","feedback","agent-tasks","agent-pipelines","conversations","messages","katas","kata-progress","templates","marketplace","workspaces","workspace-members","comments","preferences","profiles"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["resource","id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/create_project":{"post":{"tags":["tools"],"operationId":"create_project","summary":"Create an ML project.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"model_type":{"description":"e.g. classification, regression, llm, vision","type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/use_template":{"post":{"tags":["tools"],"operationId":"use_template","summary":"Start a project from a use-case template (list_records resource=templates), like 'Use template' in the web app: creates the project and runs a real synthetic_data simulation that writes a starter dataset with the template's columns. Returns {project, simulation}; wait_for_run on the simulation for the dataset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"template_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"description":"Project name (default: template name + date)","type":"string"},"row_count":{"description":"Starter rows (default 50)","type":"integer","minimum":1,"maximum":500}},"required":["template_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/activate_model_version":{"post":{"tags":["tools"],"operationId":"activate_model_version","summary":"Make a model version its project's active version (the previous active one is archived). Deployments and agents with no explicit model use the active version.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/create_dataset":{"post":{"tags":["tools"],"operationId":"create_dataset","summary":"Create a dataset from inline data — `rows` (array of objects) or `csv` (text with a header row), up to 5000 rows — stored as CSV. Use columns named input/expected (or prompt/answer, question/label, …) to make it usable as a test set for training and evaluations. Larger files are uploaded in the web app.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"rows":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"csv":{"type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/profile_dataset":{"post":{"tags":["tools"],"operationId":"profile_dataset","summary":"Read a dataset's file and report its real row count, columns, a 5-row preview and whether it works as a test set (which columns are read as input/expected). save=true (default) records the counts and status on the dataset.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"save":{"default":true,"type":"boolean"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/train_model":{"post":{"tags":["tools"],"operationId":"train_model","summary":"Create a training run and start it. REAL methods: prompt_tuning (optimises a system prompt for the project's task on base_model over several judge-scored rounds) and automl (model search: scores the task on 3-5 catalog models and picks the best by accuracy, latency as tie-break). Both use the dataset's input/expected rows or generated test cases, hold out 30% for a final check, and on completion save an active model version to the project (project_id needed for that). GPU method: audio_lora trains a real LoRA adapter on ACE-Step 1.5 from a dataset that is a ZIP of at least 4 audio files, each with an optional <name>.caption.txt (upload it on the web app's Datasets page; the API can't upload files). It needs rights_confirmed=true, is limited to accounts with GPU training enabled (one run at a time), reserves GPU credits up front and charges only the GPU time used (check get_gpu_credits first), runs for minutes to hours, and saves a draft model version that can't be activated or used for text evaluations/deployments; get_audio_samples returns its base vs tuned clips. PREVIEW methods: lora, finetune, rlhf for text models — simulated, no weights are trained yet (metrics.simulated=true). Poll with wait_for_run; results land in metrics.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"pipeline_type":{"default":"prompt_tuning","type":"string","enum":["prompt_tuning","automl","audio_lora","lora","finetune","rlhf"]},"project_id":{"description":"Project whose task is optimised; receives the resulting model version","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"base_model":{"description":"Catalog key for prompt_tuning, e.g. llama-3.1-8b (default), gpt-4.1-mini","type":"string"},"dataset_id":{"description":"Dataset with input/expected columns (omit to generate test cases from the task); for audio_lora, a ZIP of audio files","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"rounds":{"description":"prompt_tuning rounds (default 3)","type":"integer","minimum":1,"maximum":5},"cases":{"description":"Test cases (default 10)","type":"integer","minimum":4,"maximum":50},"models":{"description":"automl: catalog keys to compare (default a small/large mix)","minItems":2,"maxItems":5,"type":"array","items":{"type":"string"}},"rights_confirmed":{"description":"audio_lora: the user confirms they have the rights to train on this audio (required)","type":"boolean"},"epochs":{"description":"audio_lora epochs (default 500)","type":"integer","minimum":1,"maximum":1000},"rank":{"description":"audio_lora LoRA rank (default 64)","type":"integer","minimum":4,"maximum":128},"sample_prompts":{"description":"audio_lora: up to 2 prompts to render base vs tuned samples with","maxItems":2,"type":"array","items":{"type":"string"}},"config":{"description":"Extra config: candidates (per round, default 3), initial_prompt, task. Preview methods store hyperparameters here.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"start":{"default":true,"type":"boolean"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/start_training_run":{"post":{"tags":["tools"],"operationId":"start_training_run","summary":"(Re)start an existing training run. prompt_tuning/automl run for real and save a new model version; audio_lora trains on GPUs and reserves GPU credits (see train_model); lora/finetune/rlhf are simulated previews.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/get_gpu_credits":{"post":{"tags":["tools"],"operationId":"get_gpu_credits","summary":"GPU training (audio_lora) is paid in credits: a run reserves required_per_run credits before it starts and is charged only for the GPU time it used. Returns the balance, the reservation, whether that's enough, and whether GPU training is enabled for this account.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/buy_gpu_credits":{"post":{"tags":["tools"],"operationId":"buy_gpu_credits","summary":"Create a hosted checkout link for GPU credits (default: the shortfall for one run). Nothing is charged by this call: give the URL to the human to open and pay.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"credits":{"description":"Credits to buy; omit for the shortfall to cover one run","type":"integer","minimum":1,"maximum":9007199254740991}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/get_audio_samples":{"post":{"tags":["tools"],"operationId":"get_audio_samples","summary":"For a finished audio_lora training run, return its generated clips (the same prompt rendered by the base and the tuned model) with download URLs valid for 15 minutes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"Training run id"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/evaluate_model":{"post":{"tags":["tools"],"operationId":"evaluate_model","summary":"Create and run a real evaluation: the target model answers test cases (from a dataset, or generated from the project's task) and an LLM judge grades every answer. accuracy = correct vs expected, hallucination = fabricated/unsupported claims, bias = paired prompts differing only in a demographic attribute, custom = your criteria rubric, comprehensive = accuracy + hallucination + bias. Latency (p50/p95/p99) is measured on real calls. Results include per-case verdicts and a 0-100 trust score (comprehensive: accuracy 50%, hallucination 30%, bias 20%). Follow with wait_for_run.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"eval_type":{"default":"comprehensive","type":"string","enum":["accuracy","hallucination","bias","custom","comprehensive"]},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"pipeline_id":{"description":"Training run being evaluated (its resulting model version is used as the target)","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"model":{"description":"Base model to evaluate (catalog key, e.g. llama-3.1-8b)","type":"string"},"model_version_id":{"description":"Model version to evaluate","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deployment_id":{"description":"Deployment to evaluate","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dataset_id":{"description":"Test set (columns like input/expected); omit to generate cases from the project's task","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"cases":{"description":"Number of test cases (default 12)","type":"integer","minimum":1,"maximum":50},"criteria":{"description":"Rubric the judge applies; required for eval_type custom","type":"string"},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"run":{"default":true,"type":"boolean"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/run_evaluation":{"post":{"tags":["tools"],"operationId":"run_evaluation","summary":"(Re)run an existing evaluation for real against its configured target and test set. Follow with wait_for_run.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/run_simulation":{"post":{"tags":["tools"],"operationId":"run_simulation","summary":"Create and run a real simulation against a model. synthetic_data: the judge model writes rows for your columns and saves them as a new dataset. adversarial: generates attack prompts, runs them on the target and grades which succeeded (robustness_score = % defended). stress_test: fires real concurrent requests and measures latency percentiles, error rate and throughput. scenario: runs given or generated scenarios on the target and grades pass/fail. Runs in the background — use wait_for_run.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"simulation_type":{"type":"string","enum":["synthetic_data","adversarial","stress_test","scenario"]},"description":{"type":"string"},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"config":{"description":"Target: deployment_id | model_version_id | model | project_id, optional system_prompt. synthetic_data: columns [{name,type,description}] or schema_description, row_count (default 50, max 500). adversarial: attack_types (prompt_injection, jailbreak, data_exfiltration, harmful_content, pii_leak), attacks_per_type (default 4, max 15). stress_test: concurrent_requests (default 8, max 20), total_requests (default 24, max 60), prompt. scenario: scenarios [{name,input,success_criteria}] or scenario_count to generate (default 6, max 20).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","simulation_type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/deploy_model":{"post":{"tags":["tools"],"operationId":"deploy_model","summary":"Create a deployment and deploy it. Serves a model version (model_version_id) or a base model + system prompt (model, system_prompt); without either, the project's active model version. A real smoke-test call validates it: on success status is active and endpoint_url is a live OpenAI-compatible chat completions URL (auth: Authorization: Bearer kojen_… API key of this account); on failure status is failed with config.last_error.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"environment":{"default":"staging","type":"string","enum":["staging","production"]},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"model_version_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"model":{"description":"Base model to serve, e.g. llama-3.1-8b (ignored when model_version_id is set)","type":"string"},"system_prompt":{"description":"System prompt prepended to every request","type":"string"},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/set_deployment_running":{"post":{"tags":["tools"],"operationId":"set_deployment_running","summary":"Start (running=true) or stop (running=false) a deployment endpoint. Stopped endpoints reject requests with 409; starting a never-deployed or failed one redeploys it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"running":{"type":"boolean"}},"required":["id","running"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/dispatch_agent":{"post":{"tags":["tools"],"operationId":"dispatch_agent","summary":"Dispatch a real autonomous agent task; it works step by step, writing a live log (logs) and its findings (output_result). data_cleaner profiles a dataset (nulls, duplicates, whitespace/casing, bad numbers), cleans it deterministically, saves '<name> (cleaned)' as a new dataset and adds judge recommendations. researcher recommends an approach and catalog models, then benchmarks 2-3 models on 3 generated cases (measured accuracy/latency). trainer runs a real prompt-tuning training run and reports its metrics and model version. evaluator runs a comprehensive evaluation and reports the trust score. deployer deploys to staging and reports the endpoint_url. Returns the running task; follow it with wait_for_run.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"agent_type":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"input_config":{"description":"Per agent_type, all optional — data_cleaner: {dataset_id} (default: the project's newest dataset); researcher: {compare (default true), models: [catalog keys]}; trainer: {base_model, dataset_id, cases} (default model: the project's active version); evaluator: {model_version_id | model, dataset_id, cases (default 12), training_pipeline_id}; deployer: {model_version_id | model, environment: staging|production}","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["agent_type","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/cancel_agent_task":{"post":{"tags":["tools"],"operationId":"cancel_agent_task","summary":"Cancel a queued or running agent task (child runs it already started keep their own status).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/orchestrate_agents":{"post":{"tags":["tools"],"operationId":"orchestrate_agents","summary":"Create a real multi-agent pipeline (ordered steps) and optionally run it, e.g. clean → train → evaluate → deploy. Each step runs as an agent task in the pipeline's project; outputs flow forward (cleaned dataset → trainer, recommended model → trainer, trained model version → evaluator/deployer). A failed step fails the pipeline; results hold per-step summaries, task ids and total duration.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"project_id":{"description":"Project to attach this to","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"steps":{"minItems":1,"type":"array","items":{"type":"object","properties":{"agent_type":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]},"name":{"type":"string"},"input_config":{"description":"Optional overrides for this step's agent (same keys as dispatch_agent input_config)","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["agent_type","name"]}},"run":{"default":true,"type":"boolean"}},"required":["name","steps"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/run_agent_pipeline":{"post":{"tags":["tools"],"operationId":"run_agent_pipeline","summary":"(Re)run an existing orchestrator pipeline from its first step (resets step statuses).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/import_marketplace_listing":{"post":{"tags":["tools"],"operationId":"import_marketplace_listing","summary":"Copy a published marketplace listing's model (base model + system prompt) into one of your projects as a new draft model version. Evaluate it, then activate_model_version.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"listing_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"project_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["listing_id","project_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/rate_marketplace_listing":{"post":{"tags":["tools"],"operationId":"rate_marketplace_listing","summary":"Rate a published marketplace listing 1-5 stars (one rating per user; rating again replaces it). Returns the new average.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"listing_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"stars":{"type":"integer","minimum":1,"maximum":5}},"required":["listing_id","stars"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/invite_to_workspace":{"post":{"tags":["tools"],"operationId":"invite_to_workspace","summary":"Add an existing Kojen user to a workspace by email. Only workspace owners and admins can invite.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"workspace_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"default":"member","type":"string","enum":["admin","member","viewer"]}},"required":["workspace_id","email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/list_katas":{"post":{"tags":["tools"],"operationId":"list_katas","summary":"List training katas with the caller's progress on each.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"difficulty":{"type":"string","enum":["beginner","intermediate","advanced","master"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/start_kata":{"post":{"tags":["tools"],"operationId":"start_kata","summary":"Start (or retry) a kata. Read its instructions and expected_output, do the work, then call complete_kata.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kata_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kata_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/complete_kata":{"post":{"tags":["tools"],"operationId":"complete_kata","summary":"Submit a kata attempt. Pass your `submission` (the work, as text) to have it graded 0-100 by an LLM judge against the brief, or a `score` you measured yourself. 70+ completes the kata; the best score is kept.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kata_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"submission":{"description":"Your solution: code, config, answers or a write-up","type":"string","maxLength":20000},"score":{"type":"integer","minimum":0,"maximum":100}},"required":["kata_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/wait_for_run":{"post":{"tags":["tools"],"operationId":"wait_for_run","summary":"Wait until a training run, evaluation, simulation, deployment, agent task or agent pipeline finishes (or the timeout passes), then return it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource":{"type":"string","enum":["training-pipelines","evaluations","simulations","deployments","agent-tasks","agent-pipelines"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"timeout_seconds":{"default":60,"type":"integer","minimum":1,"maximum":240}},"required":["resource","id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/tools/ask_sensei":{"post":{"tags":["tools"],"operationId":"ask_sensei","summary":"Ask Sensei, Kojen's AI training guide, for advice. mode=intent_to_model turns a problem description into a full plan (dataset schema, model, eval, deployment).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"question":{"type":"string","minLength":1},"mode":{"default":"chat","type":"string","enum":["chat","intent_to_model"]}},"required":["question"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Kojen API key (kojen_…)"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"status":{"type":"integer"},"message":{"type":"string"}}}}}}}}},"schemas":{"Projects":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","training","evaluating","deployed","archived"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"model_type":{"type":"string"}}},"ProjectsInput":{"type":"object","properties":{"status":{"type":"string","enum":["draft","training","evaluating","deployed","archived"]},"name":{"type":"string"},"description":{"type":"string"},"model_type":{"type":"string"}}},"Datasets":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"file_size":{"type":"integer"},"status":{"type":"string","enum":["uploading","processing","ready","error"]},"row_count":{"type":"integer"},"column_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"file_path":{"type":"string"},"file_type":{"type":"string"}}},"DatasetsInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"file_size":{"type":"integer"},"status":{"type":"string","enum":["uploading","processing","ready","error"]},"row_count":{"type":"integer"},"column_count":{"type":"integer"},"name":{"type":"string"},"file_type":{"type":"string"}}},"TrainingPipelines":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"pipeline_type":{"type":"string","enum":["automl","finetune","rlhf","prompt_tuning","lora","audio_lora"]},"config":{},"status":{"type":"string","enum":["draft","queued","running","completed","failed"]},"progress":{"type":"integer"},"metrics":{},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"}}},"TrainingPipelinesInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"pipeline_type":{"type":"string","enum":["automl","finetune","rlhf","prompt_tuning","lora","audio_lora"]},"config":{},"name":{"type":"string"}}},"Evaluations":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"pipeline_id":{"type":"string","format":"uuid"},"eval_type":{"type":"string","enum":["accuracy","hallucination","bias","custom","comprehensive"]},"config":{},"results":{},"trust_score":{"type":"number"},"status":{"type":"string","enum":["pending","running","completed","failed"]},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"}}},"EvaluationsInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"pipeline_id":{"type":"string","format":"uuid"},"eval_type":{"type":"string","enum":["accuracy","hallucination","bias","custom","comprehensive"]},"config":{},"name":{"type":"string"}}},"Simulations":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"config":{},"results":{},"project_id":{"type":"string","format":"uuid"},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"simulation_type":{"type":"string","enum":["synthetic_data","adversarial","stress_test","scenario"]},"status":{"type":"string"},"user_id":{"type":"string"}}},"SimulationsInput":{"type":"object","properties":{"config":{},"project_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string"},"simulation_type":{"type":"string","enum":["synthetic_data","adversarial","stress_test","scenario"]}}},"SyntheticDatasets":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"simulation_id":{"type":"string","format":"uuid"},"schema_def":{},"row_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"file_path":{"type":"string"}}},"SyntheticDatasetsInput":{"type":"object","properties":{"schema_def":{},"name":{"type":"string"},"status":{"type":"string"}}},"ModelVersions":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"version_number":{"type":"integer"},"metrics":{},"config_snapshot":{},"status":{"type":"string","enum":["draft","active","archived"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"notes":{"type":"string"},"file_path":{"type":"string"}}},"ModelVersionsInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"version_number":{"type":"integer"},"metrics":{},"config_snapshot":{},"status":{"type":"string","enum":["draft","active","archived"]},"name":{"type":"string"},"notes":{"type":"string"},"file_path":{"type":"string"}}},"Deployments":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"model_version_id":{"type":"string","format":"uuid"},"environment":{"type":"string","enum":["staging","production"]},"status":{"type":"string","enum":["deploying","active","stopped","failed"]},"health":{"type":"number"},"metrics":{},"config":{},"deployed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"endpoint_url":{"type":"string"}}},"DeploymentsInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"model_version_id":{"type":"string","format":"uuid"},"environment":{"type":"string","enum":["staging","production"]},"config":{},"name":{"type":"string"}}},"DeploymentMetrics":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deployment_id":{"type":"string","format":"uuid"},"value":{"type":"number"},"threshold":{"type":"number"},"is_alert":{"type":"boolean"},"metadata":{},"recorded_at":{"type":"string","format":"date-time"},"metric_type":{"type":"string"},"user_id":{"type":"string"}}},"DeploymentMetricsInput":{"type":"object","properties":{"deployment_id":{"type":"string","format":"uuid"},"value":{"type":"number"},"threshold":{"type":"number"},"is_alert":{"type":"boolean"},"metadata":{},"recorded_at":{"type":"string","format":"date-time"},"metric_type":{"type":"string"}}},"Feedback":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deployment_id":{"type":"string","format":"uuid"},"input_data":{},"prediction":{},"correction_data":{},"created_at":{"type":"string","format":"date-time"},"prediction_id":{"type":"string"},"feedback":{"type":"string"},"user_id":{"type":"string"}}},"FeedbackInput":{"type":"object","properties":{"deployment_id":{"type":"string","format":"uuid"},"input_data":{},"prediction":{},"correction_data":{},"prediction_id":{"type":"string"},"feedback":{"type":"string"}}},"AgentTasks":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"agent_type":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]},"status":{"type":"string","enum":["queued","running","completed","failed","cancelled"]},"progress":{"type":"integer"},"input_config":{},"output_result":{},"logs":{},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"user_id":{"type":"string"}}},"AgentTasksInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"agent_type":{"type":"string","enum":["data_cleaner","trainer","evaluator","deployer","researcher"]},"input_config":{},"name":{"type":"string"},"description":{"type":"string"}}},"AgentPipelines":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"project_id":{"type":"string","format":"uuid"},"steps":{},"current_step":{"type":"integer"},"status":{"type":"string"},"results":{},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}}},"AgentPipelinesInput":{"type":"object","properties":{"project_id":{"type":"string","format":"uuid"},"steps":{},"name":{"type":"string"},"description":{"type":"string"}}},"Conversations":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pinned":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"title":{"type":"string"},"context":{"type":"string"}}},"ConversationsInput":{"type":"object","properties":{"pinned":{"type":"boolean"},"title":{"type":"string"},"context":{"type":"string"}}},"Messages":{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"conversation_id":{"type":"string","format":"uuid"},"tool_calls":{},"tool_result":{},"user_id":{"type":"string"},"role":{"type":"string"},"content":{"type":"string"},"tool_name":{"type":"string"}}},"MessagesInput":{"type":"object","properties":{"conversation_id":{"type":"string","format":"uuid"},"tool_calls":{},"tool_result":{},"role":{"type":"string"},"content":{"type":"string"},"tool_name":{"type":"string"}}},"Katas":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"difficulty":{"type":"string","enum":["beginner","intermediate","advanced","master"]},"is_public":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"instructions":{"type":"string"},"expected_output":{"type":"string"}}},"KatasInput":{"type":"object","properties":{"difficulty":{"type":"string","enum":["beginner","intermediate","advanced","master"]},"is_public":{"type":"boolean"},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"instructions":{"type":"string"},"expected_output":{"type":"string"}}},"KataProgress":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kata_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"score":{"type":"integer"},"attempts":{"type":"integer"},"best_result":{},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"}}},"KataProgressInput":{"type":"object","properties":{"kata_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"score":{"type":"integer"},"attempts":{"type":"integer"},"best_result":{}}},"Templates":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dataset_schema":{},"model_config":{},"eval_config":{},"deployment_config":{},"is_public":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"use_case":{"type":"string"},"icon":{"type":"string"},"difficulty":{"type":"string"},"estimated_time":{"type":"string"},"tags":{"type":"array","items":{}},"slug":{"type":"string"}}},"TemplatesInput":{"type":"object","properties":{"dataset_schema":{},"model_config":{},"eval_config":{},"deployment_config":{},"is_public":{"type":"boolean"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"use_case":{"type":"string"},"icon":{"type":"string"},"difficulty":{"type":"string"},"estimated_time":{"type":"string"},"tags":{"type":"array","items":{}},"slug":{"type":"string"}}},"Marketplace":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"model_version_id":{"type":"string","format":"uuid"},"price":{"type":"number"},"downloads":{"type":"integer"},"rating":{"type":"number"},"is_published":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"model_type":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{}}}},"MarketplaceInput":{"type":"object","properties":{"model_version_id":{"type":"string","format":"uuid"},"price":{"type":"number"},"is_published":{"type":"boolean"},"title":{"type":"string"},"description":{"type":"string"},"model_type":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{}}}},"Workspaces":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"owner_id":{"type":"string"}}},"WorkspacesInput":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}},"WorkspaceMembers":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"joined_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"}}},"WorkspaceMembersInput":{"type":"object","properties":{"workspace_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"joined_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"}}},"Comments":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"target_id":{"type":"string","format":"uuid"},"parent_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"target_type":{"type":"string"},"content":{"type":"string"}}},"CommentsInput":{"type":"object","properties":{"target_id":{"type":"string","format":"uuid"},"parent_id":{"type":"string","format":"uuid"},"target_type":{"type":"string"},"content":{"type":"string"}}},"Preferences":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"value":{},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"key":{"type":"string"}}},"PreferencesInput":{"type":"object","properties":{"value":{},"key":{"type":"string"}}},"Profiles":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"onboarding_completed":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":"string"},"display_name":{"type":"string"},"avatar_url":{"type":"string"},"bio":{"type":"string"},"industry":{"type":"string"}}},"ProfilesInput":{"type":"object","properties":{"onboarding_completed":{"type":"boolean"},"display_name":{"type":"string"},"avatar_url":{"type":"string"},"bio":{"type":"string"},"industry":{"type":"string"}}}}}}