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
32
33
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/claude-3-opus";
const data = {
"instruction": "Respond in a playful and humorous manner, keeping the tone light and entertaining.",
"temperature": 0.1,
"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);
}
})();
System prompt to give the LLM some context
Randomness variable between 0 - 1.
An array of objects containing the role and content
Could be "user", "assistant" or "system".
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 Opus is a large language model (LLM) created by Anthropic AI. It is considered to be one of the most powerful and intelligent AI models currently available, outperforming its peers on many complex tasks.
Benchmark Leader: Claude 3 Opus boasts top scores on several AI evaluation benchmarks, including:
MMLU (undergraduate-level knowledge): Demonstrates a strong understanding of factual information.
GPQA (graduate-level reasoning): Excels at complex reasoning and problem-solving tasks.
GSM8K (basic math): Handles mathematical calculations with high accuracy.
Human-like Fluency: It can generate text that is not only factually accurate but also creative, nuanced, and engaging, approaching human-level quality.
Multilingual Powerhouse: While English is its primary language, it can process and respond in languages like Spanish, Japanese, and French, making it valuable for global applications.
Large Context Window: With a context window of 200,000 tokens (roughly equivalent to a large book), it remembers past information in a conversation, leading to more coherent and relevant responses.