DeepSeek R1
DeepSeek-R1 is a cutting-edge AI reasoning model that combines reinforcement learning with supervised fine-tuning. Excels in complex problem-solving, mathematics, and coding tasks.
API Format: OpenAI GPT (Standard Format)
This model uses OpenAI-compatible request/response format.
1import requests
2
3url = "https://api.segmind.com/v1/deepseek-reasoner"
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/deepseek-reasoner"
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/deepseek-reasonerParameters
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": "deepseek-reasoner",
"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