Llama 3.1 405b
Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks.
API Format: OpenAI GPT (Standard Format)
This model uses OpenAI-compatible request/response format.
1import requests
2
3url = "https://api.segmind.com/v1/llama-v3p1-405b-instruct"
4
5headers = {
6 "Authorization": "Bearer YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "messages": [
12 {
13 "role": "user",
14 "content": [
15 {
16 "type": "text",
17 "text": "What's in this image?"
18 },
19 {
20 "type": "image_url",
21 "image_url": {
22 "url": "https://example.com/image.jpg"
23 }
24 }
25 ]
26 }
27 ]
28}
29
30response = requests.post(url, json=data, headers=headers)
31print(response.json()) 1import requests
2
3url = "https://api.segmind.com/v1/llama-v3p1-405b-instruct"
4
5headers = {
6 "Authorization": "Bearer YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "messages": [
12 {
13 "role": "user",
14 "content": [
15 {
16 "type": "text",
17 "text": "What's in this image?"
18 },
19 {
20 "type": "image_url",
21 "image_url": {
22 "url": "https://example.com/image.jpg"
23 }
24 }
25 ]
26 }
27 ]
28}
29
30response = requests.post(url, json=data, headers=headers)
31print(response.json())API Endpoint
POST https://api.segmind.com/v1/llama-v3p1-405b-instructParameters
messagesrequiredobject[]Array of message objects with role and content. Content can be text or multimodal (text + images).
rolerequiredstringRole of the message sender
"user""assistant"contentrequiredarrayString or array of content blocks
Response Format
{
"id": "chat_abc123",
"object": "chat.completion",
"created": 1677652288,
"model": "llama-v3p1-405b-instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I can see a beautiful sunset over the ocean with vibrant orange and pink hues in the sky."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 56,
"completion_tokens": 31,
"total_tokens": 87
}
}Image Input Format
Important: OpenAI GPT (Standard Format) Format
Images can be provided as URLs or base64 data URIs (data:image/jpeg;base64,...)
This model supports vision capabilities. You can include images in your requests.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid message format or parameters
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out