Grok 2 Vision
Grok-2, xAI's latest language model with vision understanding.
API
If you're looking for an API, you can choose from your desired programming language.
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
34
35
36
37
38
39
const axios = require('axios');
const fs = require('fs');
const path = require('path');
// helper function to help you convert your local images into base64 format
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/grok-2-vision";
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);
}
})();
Attributes
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.
Resources to get you started
Everything you need to know to get the most out of Grok 2 Vision
Grok-2 Vision
xAI's Grok-2 not only excels in language processing but also demonstrates state-of-the-art performance in vision-based tasks. This multimodal capability significantly enhances its utility across various applications.
Key Features of Grok-2 Vision
- •
Visual Math Reasoning (MathVista): Grok-2 achieves state-of-the-art performance in visual math reasoning. According to benchmarks, Grok-2 scored 69.0% on MathVista.
- •
Document-Based Question Answering (DocVQA): Grok-2 excels in understanding and answering question
Grok-2 Vision's advanced vision understanding, combined with its language capabilities, positions it as a versatile tool for various AI-driven applications. The ongoing development of multimodal understanding promises further enhancements and capabilities
Other Popular Models
Discover other models you might be interested in.
sdxl-controlnet
SDXL ControlNet gives unprecedented control over text-to-image generation. SDXL ControlNet models Introduces the concept of conditioning inputs, which provide additional information to guide the image generation process

idm-vton
Best-in-class clothing virtual try on in the wild

sdxl-inpaint
This model is capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask

codeformer
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
