Azure OpenAI - API Integration?


Any idea if and how it might be possible to use the API from Azure OpenAI as opposed to the OpenAI API?

Start by taking a look at the documentation for the API and Drafts scripting for web API.

Microsoft API Documentation

Drafts HTTP Scripting Documentation

There are plenty of examples on the forum and in the directory for working with various API (including OpenAI which will probably be quite similar in many respects) to help guide you.

Hope that helps.

Excellent thank you. I managed to make it work via HTTP request.

1 Like

It would be worth sharing what you came up with for anyone who might be looking for the same thing in the future and come across this topic.

You are right, here is what I did, to access the gpt35 turbo model in a company Azure environment.
You need two things: The proper URL and a key, both should be available via your company’s Azure Admins.
The below function focusses only on the answer text as a return.

function askthechat(prompt) {

// create HTTP object
let http = HTTP.create();

// make the API request
let response = http.request({
	"url": "",
	"method": "POST",
        "api-key": "yourKEYhere"
	"data": {
		"messages": [
				"role": "user",
				"content": prompt

// Check for success, if successful return the answer text out of the response object
// If not successful, show an alert and write to console as well

if (response.success) {
	let data = response.responseData
	let answer = data.choices[0].message.content
	return answer
else {
  alert("Request failed!\n\nstatus code: " + response.statusCode + "\nresponse error:" + response.error + "\n.")
  answer = "Failed!"
  return answer