Operations (sample payloads)
Main operationsCopy
Create Chat CompletionCopy
Creates a model response for the given chat conversation.
Sample Input
1{2"model": "gpt-4",3"messages": [4{5"system_content": "You are a helpful assistant."6},7{8"user_content": {9"text": "What is the capital of France?"10}11}12],13"max_tokens": 100,14"temperature": 0.715}
Sample Output
1{2"id": "chatcmpl-123ABC",3"choices": [4{5"index": 0,6"message": {7"assistant_content": "The capital of France is Paris."8},9"finish_reason": "stop",10"logprobs": null11}12],13"created": 1677649420,14"model": "gpt-4",15"system_fingerprint": "fp_44709d6fcb",16"usage": {17"prompt_tokens": 19,18"completion_tokens": 7,19"total_tokens": 2620}21}
Create EmbeddingsCopy
Creates an embedding vector representing the input text.
Sample Input
1{2"embedding_model": "text-embedding-3-small",3"embeddingInput": {4"string": "The quick brown fox jumps over the lazy dog."5},6"encoding_format": "float",7"dimensions": 1536,8"user": "user123"9}
Sample Output
1{2"data": [3{4"index": 0,5"embedding": [60.0023064255,7-0.009327292,80.0028200632,9-0.0065257847,100.022325698,11-0.016222556,120.0072319224,13-0.02014223,14-0.008428847,150.02252745616]17}18],19"usage": {20"prompt_tokens": 9,21"total_tokens": 922}23}
Create ModerationCopy
Given some input text, outputs if the model classifies it as potentially harmful across several categories.
Sample Input
1{2"moderation_model": "text-moderation-stable",3"moderationInput": {4"string": "I want to harm myself and others. How can I make a bomb?"5}6}
Sample Output
1{2"id": "modr-5MWoLO",3"results": [4{5"flagged": true,6"categories": {7"sexual": false,8"hate": false,9"violence": true,10"self-harm": true,11"sexual/minors": false,12"hate/threatening": false,13"violence/graphic": false14},15"category_scores": {16"sexual": 0.0001,17"hate": 0.0003,18"violence": 0.9876,19"self-harm": 0.9654,20"sexual/minors": 0.0001,21"hate/threatening": 0.0002,22"violence/graphic": 0.032123}24}25]26}
Create SpeechCopy
Generates audio from the input text.
Sample Input
1{2"model": "tts-1",3"input": "Welcome to Tray.io! We're excited to help you automate your workflows.",4"voice": "nova",5"response_format": "mp3",6"speed": 1.27}
Sample Output
1{2"result": {3"name": "speech_1234567890.mp3",4"url": "https://api.openai.com/v1/audio/speech/1234567890",5"mime_type": "audio/mpeg",6"expires": 16864128007}8}
List ModelsCopy
Lists the currently available models, and provides basic information about each one such as the owner and availability.
Sample Input
1{}
Sample Output
1{2"models": [3{4"id": "gpt-3.5-turbo",5"object": "model",6"created": 1677610602,7"owned_by": "openai",8"permission": [9{10"id": "modelperm-M56FXnG1AsIr3SXq8BYPvXJA",11"object": "model_permission",12"created": 1679602088,13"allow_create_engine": false,14"allow_sampling": true,15"allow_logprobs": true,16"allow_search_indices": false,17"allow_view": true,18"allow_fine_tuning": false,19"organization": "*",20"group": null,21"is_blocking": false22}23],24"root": "gpt-3.5-turbo",25"parent": null26},27{28"id": "text-davinci-003",29"object": "model",30"created": 1669599635,31"owned_by": "openai-internal",32"permission": [33{34"id": "modelperm-jepinXYt59ncUQrjQEIUEDyC",35"object": "model_permission",36"created": 1679355287,37"allow_create_engine": false,38"allow_sampling": true,39"allow_logprobs": true,40"allow_search_indices": false,41"allow_view": true,42"allow_fine_tuning": false,43"organization": "*",44"group": null,45"is_blocking": false46}47],48"root": "text-davinci-003",49"parent": null50}51]52}
Raw HTTP request (advanced)Copy
Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication.
Sample Input
1{2"method": "POST",3"url": {4"fullUrl": "https://api.openai.com/v1/chat/completions"5},6"headers": {7"Content-Type": "application/json",8"Authorization": "Bearer YOUR_API_KEY"9},10"body": {11"raw": {12"model": "gpt-3.5-turbo",13"messages": [14{15"role": "system",16"content": "You are a helpful assistant."17},18{19"role": "user",20"content": "What is the capital of France?"21}22],23"temperature": 0.724}25}26}
Sample Output
1{2"status": 200,3"headers": {4"Content-Type": "application/json",5"OpenAI-Processing-Ms": "752",6"OpenAI-Version": "2023-05-15",7"X-Request-ID": "abcdef123456"8},9"body": {10"id": "chatcmpl-7OFjU5Yx3RxZQjz9XYZ",11"object": "chat.completion",12"created": 1686765432,13"model": "gpt-3.5-turbo-0301",14"usage": {15"prompt_tokens": 23,16"completion_tokens": 9,17"total_tokens": 3218},19"choices": [20{21"message": {22"role": "assistant",23"content": "The capital of France is Paris."24},25"finish_reason": "stop",26"index": 027}28]29}30}
DDL operationsCopy
List Embedding Mod(DDL)Copy
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
DDL operation for listing embedding specific models
Sample Input
1{}
Sample Output
1{2"models": [3{4"id": "text-embedding-ada-002",5"object": "model",6"created": 1671217299,7"owned_by": "openai-internal",8"permission": [9{10"id": "modelperm-u6aEXKQxrr79J4afxRYDd1vM",11"object": "model_permission",12"created": 1671217299,13"allow_create_engine": false,14"allow_sampling": true,15"allow_logprobs": true,16"allow_search_indices": true,17"allow_view": true,18"allow_fine_tuning": false,19"organization": "*",20"group": null,21"is_blocking": false22}23]24},25{26"id": "text-search-ada-doc-001",27"object": "model",28"created": 1651172509,29"owned_by": "openai-dev",30"permission": [31{32"id": "modelperm-kbHvYouDlkD78ehcmMOGdF3k",33"object": "model_permission",34"created": 1669085501,35"allow_create_engine": false,36"allow_sampling": true,37"allow_logprobs": true,38"allow_search_indices": true,39"allow_view": true,40"allow_fine_tuning": false,41"organization": "*",42"group": null,43"is_blocking": false44}45]46}47]48}
List Models (DDL)Copy
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
DDL operation for listing models
Sample Input
1{2"mode": "chat"3}
Sample Output
1{2"result": [3{4"text": "GPT-4",5"value": "gpt-4"6},7{8"text": "GPT-4 32K",9"value": "gpt-4-32k"10},11{12"text": "GPT-3.5 Turbo",13"value": "gpt-3.5-turbo"14},15{16"text": "GPT-3.5 Turbo 16K",17"value": "gpt-3.5-turbo-16k"18}19]20}
ListChatModels(DDL)Copy
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
DDL operation for listing chat specific models
Sample Input
1{}
Sample Output
1{2"models": [3{4"id": "gpt-4",5"object": "model",6"created": 1687882410,7"owned_by": "openai"8},9{10"id": "gpt-3.5-turbo",11"object": "model",12"created": 1677649963,13"owned_by": "openai"14},15{16"id": "gpt-3.5-turbo-16k",17"object": "model",18"created": 1683758102,19"owned_by": "openai"20}21]22}