1. Please reach out to [email protected] ****for the API key and endpoints.

  2. API Endpoints (provided by Stella AI)

    1. Production

      POST <https://xyz>...xyz/ask
      
    2. Test

      POST <https://xyz>...xyz/ask/test
      
  3. Request headers

  4. Request parameters

  5. Response format

    1. When the stream parameter is set to true, the API response will be sent as a streaming response. In this case, the chatId will be included in the response headers under the Stella-Chat-ID header. The actual response content, which is the streamable message, will be sent in the response body.
    2. When the stream parameter is set to false, the API response will be a standard JSON response. The response body will be a JSON object with two fields: chatId and reply.
  6. Test Environment

Sample javascript code

const fetchStellaResponse = async () => {
  const url = "<https://xyz>...xyz/ask";
  const payload = {
    question: "Can you explain step 4 of this working out?",
    image_url: "<https://uploaded-image.jpeg>",
    chat_id**: "**8fc21c09-c5c0-4454-a9fd-e1eb8db9016e",
    topic_key: "maths_ext_one_hsc_vectors",
    stream: false,
  };
  const headers = {
    'Stella-Api-Key': 'stella-xYz71......abC',
    'Content-Type': 'application/json'
  };
  try {
    const response = await fetch(url, {
      method: "POST",
      headers: headers,
      body: JSON.stringify(payload)
    });
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
		
    const { reply, chatId } = await response.json(); 
    console.log(reply, chatId);
  } catch (error) {
    console.error('Error fetching data: ', error);
  }
};

fetchStellaResponse();

Sample output

{
  "reply": "Sure, let's break this down step by step...",
  "chatId": "8fc21c09-c5c0-4454-a9fd-e1eb8db9016e"
}

Error Codes

Code Overview
400 - Invalid Request Body Cause: The request body contains invalid or missing properties.

Solution: Ensure that the required properties (question, topic_key) are provided and are of the correct data types. Optional properties (image_url, chat_id, model, stream) should also have valid data types if provided. | | 401 - Missing or Invalid API Key | Cause: The stella-api-key header is missing, not a string, or does not match any organisation.

Solution: Ensure that a valid API key is included in the stella-api-key header of the request. | | 429 - Too Many Requests | Cause: The client has exceeded the rate limit for their organisation.

Solution: Implement error handling and retry mechanisms to handle rate-limited requests. Each organisation is limited to a maximum of 100 requests per minute. If you require a higher rate limit, please contact [email protected]. |

Subject to topic key mapping

[
  {
    subject: "Maths Standard",
    topicKeys: [ "maths_standard_algebra", "maths_standard_measurement", "maths_standard_financial_mathematics",
      "maths_standard_statistical_analysis", "maths_standard_networks"
    ],
  }, {
    subject: "Maths Advanced",
    topicKeys: [ "maths_adv_prelim_functions", "maths_adv_prelim_trigonometric_functions",
      "maths_adv_prelim_calculus", "maths_adv_prelim_exponential_and_logarithmic_functions",
      "maths_adv_prelim_statistical_analysis", "maths_adv_hsc_functions", "maths_adv_hsc_trigonometric_functions",
      "maths_adv_hsc_calculus", "maths_adv_hsc_financial_mathematics", "maths_adv_hsc_statistical_analysis"
    ],
  }, {
    subject: "Maths Extension 1",
    topicKeys: [ "maths_ext_one_prelim_functions", "maths_ext_one_prelim_trigonometric_functions",
      "maths_ext_one_prelim_calculus", "maths_ext_one_prelim_combinatorics", "maths_ext_one_hsc_proof",
      "maths_ext_one_hsc_vectors", "maths_ext_one_hsc_trigonometric_functions", "maths_ext_one_hsc_calculus",
      "maths_ext_one_hsc_statistical_analysis"
    ],
  }, {
    subject: "Maths Extension 2",
    topicKeys: [ "maths_ext_two_proof", "maths_ext_two_vectors", "maths_ext_two_complex_numbers",
      "maths_ext_two_calculus", "maths_ext_two_mechanics"
    ],
  }, {
    subject: "Physics",
    topicKeys: [ "physics_mod_one", "physics_mod_two", "physics_mod_three", "physics_mod_four",
      "physics_mod_five", "physics_mod_six", "physics_mod_seven", "physics_mod_eight"
    ],
  }, {
    subject: "Chemistry",
    topicKeys: [ "chemistry_mod_one", "chemistry_mod_two", "chemistry_mod_three", "chemistry_mod_four",
      "chemistry_mod_five", "chemistry_mod_six", "chemistry_mod_seven", "chemistry_mod_eight"
    ],
  }, {
    subject: "Biology",
    topicKeys: [ "biology_mod_one", "biology_mod_two", "biology_mod_three", "biology_mod_four",
      "biology_mod_five", "biology_mod_six", "biology_mod_seven", "biology_mod_eight"
    ],
  }, {
    subject: "Economics",
    topicKeys: [ "economics_prelim_one", "economics_prelim_two", "economics_prelim_three",
      "economics_prelim_four", "economics_prelim_five", "economics_prelim_six", "economics_hsc_one",
      "economics_hsc_two", "economics_hsc_three", "economics_hsc_four"
    ],
  }
]