POST
javascript
1const axios = require('axios'); 2 3 4const api_key = "YOUR API-KEY"; 5const url = "https://api.segmind.com/v1/claude-3-haiku"; 6 7const data = { 8 "messages": [ 9 { 10 "role": "user", 11 "content" : "tell me a joke on cats" 12 }, 13 { 14 "role": "assistant", 15 "content" : "here is a joke about cats..." 16 }, 17 { 18 "role": "user", 19 "content" : "now a joke on dogs" 20 }, 21 ] 22}; 23 24(async function() { 25 try { 26 const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); 27 console.log(response.data); 28 } catch (error) { 29 console.error('Error:', error.response.data); 30 } 31})();
RESPONSE
application/json
HTTP Response Codes
200 - OKImage 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.

Claude 3 Haiku

Claude 3 Haiku is an exciting addition to the Claude 3 model family developed by Anthropic. It is one of the fastest and most affordable model in its intelligence class. It offers state-of-the-art vision capabilities for processing and analyzing image data. With its unmatched speed, Haiku is a versatile solution for a wide range of enterprise applications. Haiku is designed for near-instant responsiveness. It answers simple queries and requests with remarkable speed. Users can build seamless AI experiences that mimic human interactions using this model. It’s part of the Claude 3 family, which sets new industry benchmarks across various cognitive tasks. Claude 3 Haiku can read and summarize research papers in less than three seconds. Its compact size and affordability make it an attractive choice for various applications.