# Initialize Cortex instance POST https://api.forbocai.com/v1/cortex/init Content-Type: application/json Downloads model weights (if needed) and initializes a Cortex instance. Reference: https://docs.forboc.ai/api-reference/endpoints/forboc-ai-sdk-api/cortex/init-cortex ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Initialize Cortex instance version: endpoint_cortex.initCortex paths: /cortex/init: post: operationId: init-cortex summary: Initialize Cortex instance description: Downloads model weights (if needed) and initializes a Cortex instance. tags: - - subpackage_cortex parameters: [] responses: '201': description: Cortex instance created content: application/json: schema: $ref: '#/components/schemas/CortexInstance' '400': description: Invalid configuration content: {} '503': description: Runtime not supported on this device content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/CortexInitRequest' components: schemas: CortexInitRequest: type: object properties: model: type: string description: Model ID to load config: type: object additionalProperties: description: Any type description: Optional environment-specific configuration required: - model CortexInstanceStatus: type: string enum: - value: loading - value: ready - value: error CortexInstance: type: object properties: id: type: string model: type: string runtime: type: string status: $ref: '#/components/schemas/CortexInstanceStatus' createdAt: type: string format: date-time ``` ## SDK Code Examples ```python Auto-detect runtime import requests url = "https://api.forbocai.com/v1/cortex/init" payload = { "model": "forbocai-neuro-symbolic-v1" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Auto-detect runtime const url = 'https://api.forbocai.com/v1/cortex/init'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"model":"forbocai-neuro-symbolic-v1"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Auto-detect runtime package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.forbocai.com/v1/cortex/init" payload := strings.NewReader("{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Auto-detect runtime require 'uri' require 'net/http' url = URI("https://api.forbocai.com/v1/cortex/init") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}" response = http.request(request) puts response.read_body ``` ```java Auto-detect runtime HttpResponse response = Unirest.post("https://api.forbocai.com/v1/cortex/init") .header("Content-Type", "application/json") .body("{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}") .asString(); ``` ```php Auto-detect runtime request('POST', 'https://api.forbocai.com/v1/cortex/init', [ 'body' => '{ "model": "forbocai-neuro-symbolic-v1" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Auto-detect runtime var client = new RestClient("https://api.forbocai.com/v1/cortex/init"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Auto-detect runtime import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["model": "forbocai-neuro-symbolic-v1"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.forbocai.com/v1/cortex/init")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ```python import requests url = "https://api.forbocai.com/v1/cortex/init" payload = { "model": "forbocai-neuro-symbolic-v1" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.forbocai.com/v1/cortex/init'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"model":"forbocai-neuro-symbolic-v1"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.forbocai.com/v1/cortex/init" payload := strings.NewReader("{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.forbocai.com/v1/cortex/init") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.forbocai.com/v1/cortex/init") .header("Content-Type", "application/json") .body("{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}") .asString(); ``` ```php request('POST', 'https://api.forbocai.com/v1/cortex/init', [ 'body' => '{ "model": "forbocai-neuro-symbolic-v1" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.forbocai.com/v1/cortex/init"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"model\": \"forbocai-neuro-symbolic-v1\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["model": "forbocai-neuro-symbolic-v1"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.forbocai.com/v1/cortex/init")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```