POST
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 const axios = require('axios'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/o1-preview"; const data = { "messages": [ { "role": "user", "content": "tell me a joke on cats" }, { "role": "assistant", "content": "here is a joke about cats..." }, { "role": "user", "content": "now a joke on dogs" } ] }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
application/json
HTTP Response Codes
200 - OKResponse Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


messagesArray

An array of objects containing the role and content


rolestr

Could be "user", "assistant" or "system".


contentstr

A string containing the user's query or the assistant's response.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

OpenAI o1-preview

o1-preview by OpenAI, is a groundbreaking AI model designed to tackle complex problems with unprecedented reasoning abilities. This new series of models is set to redefine the landscape of artificial intelligence, offering enhanced performance in science, coding, and mathematics

Key Features of o1-preview

  • Enhanced Problem-Solving: The o1-preview model excels in solving intricate tasks, outperforming previous models in fields such as physics, chemistry, and biology. Its advanced algorithms enable it to understand and process complex scientific data, making it an invaluable tool for researchers and scientists.

  • Superior Coding Abilities: Achieving an impressive 89th percentile in Codeforces competitions, the o1-preview is a game-changer for developers. It can generate, debug, and optimize code with remarkable efficiency, significantly reducing development time and improving software quality.

  • Mathematical Prowess: With an 83% success rate in the International Mathematics Olympiad qualifying exams, this model is a powerhouse in mathematical reasoning. It can solve complex equations, perform advanced calculations, and assist in mathematical research with high accuracy.

How It Works

The o1-preview model is trained to spend more time thinking through problems, much like a human would. This approach allows it to refine its strategies, recognize mistakes, and deliver more accurate results. The model employs a multi-step reasoning process, breaking down complex problems into manageable parts and systematically solving them. In our tests, the next model update performed similarly to PhD students on challenging benchmark tasks, demonstrating its advanced cognitive abilities.

The o1-preview model incorporates a new safety training approach, ensuring adherence to safety and alignment guidelines. It scored 84 on one of our hardest jailbreaking tests, significantly higher than previous models. This rigorous safety training ensures that the model operates within ethical boundaries and minimizes the risk of harmful outputs.

Use Cases

  • Scientific Research: Leverage the o1-preview’s advanced problem-solving capabilities to accelerate research in physics, chemistry, biology, and other scientific fields.

  • Software Development: Enhance your development process with the model’s superior coding abilities, from generating boilerplate code to debugging complex algorithms.

  • Mathematical Analysis: Utilize the model’s mathematical prowess for advanced calculations, solving complex equations, and assisting in mathematical research.

  • Data Analysis: Employ the o1-preview for sophisticated data analysis tasks, enabling more accurate and insightful interpretations of large datasets.

  • Educational Tools: Integrate the model into educational platforms to provide students with advanced problem-solving assistance and enhance their learning experience.