llm-info
Version:
Information on LLM models, context window token limit, output token limit, pricing and more
25 lines (22 loc) • 519 B
Markdown
```js
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: '<api key>',
baseURL: 'https://api.x.ai/v1',
});
const completion = await client.chat.completions.create({
model: 'grok-4',
messages: [
{
role: 'system',
content:
"You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy.",
},
{
role: 'user',
content: 'What is the meaning of life, the universe, and everything?',
},
],
});
console.log(completion.choices[0].message);
```