Loading...
Loading...
DeepSeek AI large language model API via curl. Use this skill for chat completions, reasoning, and code generation with OpenAI-compatible endpoints.
npx skill4agent add vm0-ai/vm0-skills deepseekcurlOfficial docs:https://api-docs.deepseek.com/
export DEEPSEEK_API_KEY="your-api-key"| Type | Price |
|---|---|
| Input (cache hit) | $0.028 |
| Input (cache miss) | $0.28 |
| Output | $0.42 |
Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
DEEPSEEK_API_KEYhttps://api.deepseek.comhttps://api.deepseek.com/v1/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello, who are you?"
}
]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json'deepseek-chatdeepseek-reasoner/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "Write a short poem about coding."
}
],
"temperature": 0.7,
"max_tokens": 200
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq -r '.choices[0].message.content'temperaturetop_pmax_tokens/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "Explain quantum computing in simple terms."
}
],
"stream": true
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json'data: [DONE]/tmp/deepseek_request.json{
"model": "deepseek-reasoner",
"messages": [
{
"role": "user",
"content": "What is 15 * 17? Show your work."
}
]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq -r '.choices[0].message.content'/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "system",
"content": "You are a JSON generator. Always respond with valid JSON."
},
{
"role": "user",
"content": "List 3 programming languages with their main use cases."
}
],
"response_format": {
"type": "json_object"
}
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq -r '.choices[0].message.content'/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "My name is Alice."
},
{
"role": "assistant",
"content": "Nice to meet you, Alice."
},
{
"role": "user",
"content": "What is my name?"
}
]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq -r '.choices[0].message.content'/tmp/deepseek_request.json{
"model": "deepseek-chat",
"prompt": "def add(a, b):\n ",
"max_tokens": 20
}bash -c 'curl -s "https://api.deepseek.com/beta/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq -r '.choices[0].text'/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "What is the weather in Tokyo?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name"
}
},
"required": ["location"]
}
}
}
]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json'tool_calls/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json' | jq '.usage'prompt_tokenscompletion_tokenstotal_tokensfrom openai import OpenAI
client = OpenAI(api_key="your-deepseek-key", base_url="https://api.deepseek.com")import OpenAI from 'openai';
const client = new OpenAI({ apiKey: 'your-deepseek-key', baseURL: 'https://api.deepseek.com' });/tmp/deepseek_request.json{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "What is the weather in Tokyo?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"]
}
}
}]
}bash -c 'curl -s "https://api.deepseek.com/chat/completions" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" -d @/tmp/deepseek_request.json'deepseek-chatdeepseek-reasonerresponse_formatapi.deepseek.com/beta-d @filename