> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://humanloop.com/docs/v4/api/model-configs/deserialize/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/_mcp/server. # Deserialize POST https://api.humanloop.com/v4/model-configs/deserialize Content-Type: application/json Deserialize a model config from a .prompt file format. Reference: https://humanloop.com/docs/v4/api/model-configs/deserialize ## Authentication - `X-API-KEY` header (required) — API Key authentication via header ## Request ### Body (application/json) This endpoint expects an object. - `config` (string, required) ## Response ### 200 Successful Response - `id` (string, required) — String ID of config. Starts with `config_`. - `model` (string, required) — The model instance used. E.g. text-davinci-002. - `other` (map from string to any, optional) — Other parameter values to be passed to the provider call. - `name` (string, optional) — A friendly display name for the model config. If not provided, a name will be generated. - `description` (string, optional) — A description of the model config. - `provider` (enum, optional) — The company providing the underlying model service. - Allowed values: `anthropic`, `bedrock`, `cohere`, `deepseek`, `google`, `groq`, `mock`, `openai`, `openai_azure`, `replicate` - `max_tokens` (integer, optional, default: -1) — The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt - `temperature` (double, optional, default: 1) — What sampling temperature to use when making a generation. Higher values means the model will be more creative. - `top_p` (double, optional, default: 1) — An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - `stop` (ModelConfigResponseStop, optional) — The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. - `presence_penalty` (double, optional, default: 0) — Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. - `frequency_penalty` (double, optional, default: 0) — Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. - `seed` (integer, optional) — If specified, model will make a best effort to sample deterministically, but it is not guaranteed. - `response_format` (ResponseFormat, optional) — The format of the response. Only type json_object is currently supported for chat. - `reasoning_effort` (ModelConfigResponseReasoningEffort, optional) — Guidance on how many reasoning tokens it should generate before creating a response to the prompt. OpenAI reasoning models (o1, o3-mini) expect a OpenAIReasoningEffort enum. Anthropic reasoning models expect an integer, which signifies the maximum token budget. - `template_language` (enum, optional) — The template language to use for rendering the template. - Allowed values: `default`, `jinja` - `prompt_template` (string, optional) — Prompt template that will take your specified inputs to form your final request to the model. NB: Input variables within the prompt template should be specified with syntax: `{{input_name}}`. - `chat_template` (list of ChatMessageWithToolCall, optional) — Messages prepended to the list of messages sent to the provider. These messages that will take your specified inputs to form your final request to the provider model. NB: Input variables within the template should be specified with syntax: `{{input_name}}`. - `tools` (list of ToolResponse, optional) — Tools shown to the model. - `endpoint` (enum, optional) — The provider model endpoint used. - Allowed values: `complete`, `chat`, `edit` - `tool_configs` (list of ToolConfigResponse, optional, deprecated) — NB: Deprecated with tools field. Definition of tools shown to the model. ## Errors ### 422 Model Configs Deserialize Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### ModelConfigResponseStop The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. ### ResponseFormat Response format of the model. - `type` (enum, required) - Allowed values: `json_object`, `json_schema` - `json_schema` (map from string to any, optional) — The JSON schema of the response format if type is json_schema. ### ModelConfigResponseReasoningEffort Guidance on how many reasoning tokens it should generate before creating a response to the prompt. OpenAI reasoning models (o1, o3-mini) expect a OpenAIReasoningEffort enum. Anthropic reasoning models expect an integer, which signifies the maximum token budget. ### ChatMessageWithToolCall - `role` (enum, required) — Role of the message author. - Allowed values: `user`, `assistant`, `system`, `tool`, `developer` - `content` (Content, optional) — The content of the message. - `name` (string, optional) — Optional name of the message author. - `tool_call_id` (string, optional) — Tool call that this message is responding to. - `tool_calls` (list of ToolCall, optional) — A list of tool calls requested by the assistant. - `thinking` (list of ChatMessageWithToolCallThinkingItem, optional) — Model's chain-of-thought for providing the response. Present on assistant messages if model supports it. - `tool_call` (FunctionTool, optional, deprecated) — NB: Deprecated in favour of tool_calls. A tool call requested by the assistant. ### ToolResponse - `id` (string, required) — The ID of the tool. Starts with either `config_` or `oc_`. - `name` (string, required) — Name for the tool referenced by the model. - `description` (string, optional) — Description of the tool referenced by the model - `parameters` (map from string to any, optional) — Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ - `source` (string, optional) — The origin of the tool ### ToolConfigResponse - `id` (string, required) — String ID of config. Starts with `config_`. - `status` (string, required) — Whether the config is committed or not. - `name` (string, required) — Name for the tool referenced by the model. - `other` (map from string to any, optional) — Other parameters that define the config. - `created_by` (UserResponse, optional) — The user who created the config. - `description` (string, optional) — Description of the tool referenced by the model - `source` (enum, optional) — Source of the tool. If defined at an organization level will be 'organization' else 'inline'. - Allowed values: `organization`, `inline` - `source_code` (string, optional) — Code source of the tool. - `setup_schema` (map from string to any, optional) — Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ - `parameters` (map from string to any, optional) — Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ - `signature` (string, optional) — The function signature of the tool when being called. - `is_preset` (boolean, optional) — Whether the tool is one where Humanloop defines runtime or not. - `preset_name` (string, optional) — If is_preset = true, this is the name of the preset tool on Humanloop. This is used as the key to lookup the Humanloop runtime of the tool ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### Content The content of the message. ### ToolCall A tool call to be made. - `id` (string, required) - `type` ("function", required) — The type of tool to call. - `function` (FunctionTool, required) — A function tool to be called by the model where user owns runtime. ### ChatMessageWithToolCallThinkingItem - `type`: `thinking` - `signature` (string, required) — Cryptographic signature that verifies the thinking block was generated by Anthropic. - `thinking` (string, required) — Model's chain-of-thought for providing the response. - `type`: `redacted_thinking` - `data` (string, required) — Thinking block Anthropic redacted for safety reasons. User is expected to pass the block back to Anthropic ### FunctionTool A function tool to be called by the model where user owns runtime. - `name` (string, required) - `arguments` (string, optional) ### UserResponse - `id` (string, required) — String ID of user. Starts with `usr_`. - `email_address` (string, required) — The user's email address. - `verified` (boolean, required) — Whether the user has verified their email address. - `full_name` (string, optional) — The user's full name. ### ValidationErrorLocItem ## Examples **Request** ```json { "config": "config" } ``` **Response** ```json { "id": "id", "model": "model", "other": { "key": "value" }, "name": "name", "description": "description", "provider": "anthropic", "max_tokens": 1, "temperature": 1.1, "top_p": 1.1, "stop": "stop", "presence_penalty": 1.1, "frequency_penalty": 1.1, "seed": 1, "response_format": { "type": "json_object", "json_schema": { "key": "value" } }, "reasoning_effort": "high", "template_language": "default", "prompt_template": "prompt_template", "chat_template": [ { "role": "user", "content": "content", "name": "name", "tool_call_id": "tool_call_id", "tool_calls": [ { "id": "id", "type": "function", "function": { "name": "name" } } ], "thinking": [ { "type": "thinking", "signature": "signature", "thinking": "thinking" } ], "tool_call": { "name": "name" } } ], "tools": [ { "id": "id", "name": "name", "description": "description", "parameters": { "key": "value" }, "source": "source" } ], "endpoint": "complete", "tool_configs": [ { "id": "id", "status": "status", "name": "name", "other": { "key": "value" }, "created_by": { "id": "id", "email_address": "email_address", "verified": true }, "description": "description", "source": "organization", "source_code": "source_code", "setup_schema": { "key": "value" }, "parameters": { "key": "value" }, "signature": "signature", "is_preset": true, "preset_name": "preset_name" } ] } ``` **SDK Code** ```python import requests url = "https://api.humanloop.com/v4/model-configs/deserialize" payload = { "config": "config" } headers = { "X-API-KEY": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.humanloop.com/v4/model-configs/deserialize'; const options = { method: 'POST', headers: {'X-API-KEY': '', 'Content-Type': 'application/json'}, body: '{"config":"config"}' }; 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.humanloop.com/v4/model-configs/deserialize" payload := strings.NewReader("{\n \"config\": \"config\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-KEY", "") 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.humanloop.com/v4/model-configs/deserialize") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-KEY"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"config\": \"config\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.humanloop.com/v4/model-configs/deserialize") .header("X-API-KEY", "") .header("Content-Type", "application/json") .body("{\n \"config\": \"config\"\n}") .asString(); ``` ```php request('POST', 'https://api.humanloop.com/v4/model-configs/deserialize', [ 'body' => '{ "config": "config" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.humanloop.com/v4/model-configs/deserialize"); var request = new RestRequest(Method.POST); request.AddHeader("X-API-KEY", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"config\": \"config\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-API-KEY": "", "Content-Type": "application/json" ] let parameters = ["config": "config"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v4/model-configs/deserialize")! 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() ```