How it works
Add awebhook parameter to your request. The API immediately responds with status queued, then calls your webhook URL with the result once inference is complete.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Receive inference results asynchronously via HTTP callbacks.
webhook parameter to your request. The API immediately responds with status queued, then calls your webhook URL with the result once inference is complete.
import { TextGeneration } from "deepinfra";
const client = new TextGeneration(
"https://api.deepinfra.com/v1/inference/deepseek-ai/DeepSeek-V4-Flash-0731",
"$DEEPINFRA_TOKEN"
);
const res = await client.generate({
input: "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHello!<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
stop: ["<|eot_id|>"],
webhook: "https://your-app.com/deepinfra-webhook"
});
console.log(res.inference_status.status); // "queued"
curl "https://api.deepinfra.com/v1/inference/deepseek-ai/DeepSeek-V4-Flash-0731" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPINFRA_TOKEN" \
-d '{
"input": "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHello!<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
"stop": ["<|eot_id|>"],
"webhook": "https://your-app.com/deepinfra-webhook"
}'
curl "https://api.deepinfra.com/v1/inference/Qwen/Qwen3-Embedding-8B" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPINFRA_TOKEN" \
-d '{
"inputs": ["I like chocolate"],
"webhook": "https://your-app.com/deepinfra-webhook"
}'
{
"request_id": "R7X9fdlIaF5GlVisBAi5xR3E",
"inference_status": {
"status": "succeeded",
"runtime_ms": 228,
"cost": 0.0001140000022132881
},
"results": { ... }
}
{
"request_id": "RHNShFanUP5ExA8rzgyDWH88",
"inference_status": {
"status": "failed",
"runtime_ms": 0,
"cost": 0.0
}
}