Comandos para veirficar la conectividad con el servicio de modelos:
Bash
export BASE_URL="http://0.0.0.0:8000/v1"
export API_KEY="EMPTY"
export MODEL="gpt-4.1-mini"
curl -sS --fail --connect-timeout 10 --max-time 60 \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
"${BASE_URL}/models" | python -m json.tool
PowerShell
$env:BASE_URL="http://0.0.0.0:8000/v1"
$env:API_KEY="EMPTY"
$env:MODEL="gpt-4.1-mini"
curl.exe -sS --fail --connect-timeout 10 --max-time 60 `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
"$env:BASE_URL/models" | python -m json.tool
LLM: /v1/chat/completions (no streaming)
Ejemplo básico
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"messages\": [
{\"role\":\"system\",\"content\":\"Eres un asistente útil.\"},
{\"role\":\"user\",\"content\":\"Di hola en una sola oración.\"}
]
}" | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
messages = @(
@{ role="system"; content="Eres un asistente útil." },
@{ role="user"; content="Di hola en una sola oración." }
)
} | ConvertTo-Json -Depth 20
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Ejemplo con parámetros avanzados
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"temperature\": 0.2,
\"top_p\": 0.9,
\"max_tokens\": 256,
\"seed\": 42,
\"stop\": [\"\\n\\n###\"],
\"messages\": [
{\"role\":\"system\",\"content\":\"Responde brevemente.\"},
{\"role\":\"user\",\"content\":\"Resume qué es un mutex.\"}
]
}" | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
temperature = 0.2
top_p = 0.9
max_tokens = 256
seed = 42
stop = @("`n`n###")
messages = @(
@{ role="system"; content="Responde brevemente." },
@{ role="user"; content="Resume qué es un mutex." }
)
} | ConvertTo-Json -Depth 30
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
LLM: /v1/responses (no streaming)
Ejemplo básico
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/responses" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"input\": \"Di hola en una sola oración.\"
}" | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
input = "Di hola en una sola oración."
} | ConvertTo-Json -Depth 20
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/responses" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Ejemplo con parámetros avanzados
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/responses" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"temperature\": 0.2,
\"top_p\": 0.9,
\"max_output_tokens\": 256,
\"seed\": 42,
\"input\": \"Explica qué es un mutex en 3 puntos.\"
}" | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
temperature = 0.2
top_p = 0.9
max_output_tokens = 256
seed = 42
input = "Explica qué es un mutex en 3 puntos."
} | ConvertTo-Json -Depth 30
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/responses" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Salida en streaming (SSE)
/v1/chat/completions streaming
Bash
curl -N --no-buffer -sS --fail --connect-timeout 10 --max-time 0 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"stream\": true,
\"messages\": [
{\"role\":\"user\",\"content\":\"Cuenta del 1 al 20.\"}
]
}"
PowerShell
$body = @{
model = $env:MODEL
stream = $true
messages = @(
@{ role="user"; content="Cuenta del 1 al 20." }
)
} | ConvertTo-Json -Depth 20
curl.exe -N --no-buffer -sS --fail --connect-timeout 10 --max-time 0 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
/v1/responses streaming
Bash
curl -N --no-buffer -sS --fail --connect-timeout 10 --max-time 0 \
"${BASE_URL}/responses" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"stream\": true,
\"input\": \"Escribe un poema corto sobre Berlín.\"
}"
PowerShell
$body = @{
model = $env:MODEL
stream = $true
input = "Escribe un poema corto sobre Berlín."
} | ConvertTo-Json -Depth 20
curl.exe -N --no-buffer -sS --fail --connect-timeout 10 --max-time 0 `
"$env:BASE_URL/responses" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
Modelos de visión (VLM) - Imágenes y texto
Uso de image_url + texto
Bash
curl -sS --fail --connect-timeout 10 --max-time 180 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "'"${MODEL}"'",
"messages": [
{
"role": "user",
"content": [
{"type":"image_url","image_url":{"url":"https://ejemplo.com/recibo.png"}},
{"type":"text","text":"Haz OCR de esta imagen. Devuelve texto plano."}
]
}
]
}' | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
messages = @(
@{
role="user"
content=@(
@{ type="image_url"; image_url=@{ url="https://ejemplo.com/recibo.png" } },
@{ type="text"; text="Haz OCR de esta imagen. Devuelve texto plano." }
)
}
)
} | ConvertTo-Json -Depth 30
curl.exe -sS --fail --connect-timeout 10 --max-time 180 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Subida de imágenes locales
Forma A: Usar endpoint de carga
Bash
# 1) Subir (endpoint de ejemplo, cámbialo según tu servicio)
UPLOAD_URL="${BASE_URL}/uploads"
IMG_URL=$(curl -sS --fail -H "Authorization: Bearer ${API_KEY}" \
-F "file=@./recibo.png" "${UPLOAD_URL}" | python -c "import sys,json; print(json.load(sys.stdin)['url'])")
# 2) Inferencia
curl -sS --fail --connect-timeout 10 --max-time 180 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"'"${MODEL}"'",
"messages":[{"role":"user","content":[
{"type":"image_url","image_url":{"url":"'"${IMG_URL}"'"}},
{"type":"text","text":"Extrae todo el texto."}
]}]
}'
PowerShell
# Si el servicio tiene endpoint de subida: $env:BASE_URL/uploads
# La respuesta de subida incluye un campo 'url' (ejemplo)
$uploadResp = curl.exe -sS --fail `
-H "Authorization: Bearer $env:API_KEY" `
-F "file=@recibo.png" `
"$env:BASE_URL/uploads" | ConvertFrom-Json
$imgUrl = $uploadResp.url
$body = @{
model = $env:MODEL
messages = @(
@{
role="user"
content=@(
@{ type="image_url"; image_url=@{ url=$imgUrl } },
@{ type="text"; text="Extrae todo el texto." }
)
}
)
} | ConvertTo-Json -Depth 30
curl.exe -sS --fail --connect-timeout 10 --max-time 180 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
Forma B: Convertir imagen a base64
Bash
B64=$(python - <<'PY'
import base64
print(base64.b64encode(open("recibo.png","rb").read()).decode())
PY
)
curl -sS --fail --connect-timeout 10 --max-time 180 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"model\":\"${MODEL}\",
\"messages\":[
{\"role\":\"user\",\"content\":[
{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,${B64}\"}},
{\"type\":\"text\",\"text\":\"Haz OCR y devuelve solo texto.\"}
]}
]
}"
PowerShell
$b64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes("recibo.png"))
$dataUrl = "data:image/png;base64,$b64"
$body = @{
model = $env:MODEL
messages = @(
@{
role="user"
content=@(
@{ type="image_url"; image_url=@{ url=$dataUrl } },
@{ type="text"; text="Haz OCR y devuelve solo texto." }
)
}
)
} | ConvertTo-Json -Depth 30
curl.exe -sS --fail --connect-timeout 10 --max-time 180 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
Modelos pequeños (SLM) - Bajo retardo y recursos
chat/completions - Mínimo retardo
Bash
curl -sS --fail --connect-timeout 3 --max-time 15 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d "{
\"model\":\"${MODEL}\",
\"temperature\":0,
\"max_tokens\":64,
\"messages\":[{\"role\":\"user\",\"content\":\"Devuelve solo: OK\"}]
}"
PowerShell
$body = @{
model = $env:MODEL
temperature = 0
max_tokens = 64
messages = @(@{role="user"; content="Devuelve solo: OK"})
} | ConvertTo-Json -Depth 10
curl.exe -sS --fail --connect-timeout 3 --max-time 15 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
Embeddings (Vectorización)
/v1/embeddings
Bash
curl -sS --fail --connect-timeout 10 --max-time 60 \
"${BASE_URL}/embeddings" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d "{
\"model\":\"text-embedding-3-small\",
\"input\":[\"hola mundo\",\"prueba de embedding\"]
}" | python -m json.tool
PowerShell
$body = @{
model = "text-embedding-3-small"
input = @("hola mundo","prueba de embedding")
} | ConvertTo-Json -Depth 10
curl.exe -sS --fail --connect-timeout 10 --max-time 60 `
"$env:BASE_URL/embeddings" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Rerank (Reordenación)
/v1/rerank (Plantilla)
Bash
curl -sS --fail --connect-timeout 10 --max-time 60 \
"${BASE_URL}/rerank" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"modelo-rerank",
"query":"ascend npu memory leak",
"documents":[
"Cómo hacer perfil de memoria en Ascend NPU.",
"Guía para montar/desmontar en Linux.",
"Conceptos básicos de atención en Transformers."
],
"top_n":2
}' | python -m json.tool
PowerShell
$body = @{
model="modelo-rerank"
query="ascend npu memory leak"
documents=@(
"Cómo hacer perfil de memoria en Ascend NPU.",
"Guía para montar/desmontar en Linux.",
"Conceptos básicos de atención en Transformers."
)
top_n=2
} | ConvertTo-Json -Depth 20
curl.exe -sS --fail --connect-timeout 10 --max-time 60 `
"$env:BASE_URL/rerank" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Llamadas a funciones (Salida estructurada)
chat/completions: tools + tool_choice
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"'"${MODEL}"'",
"messages":[
{"role":"user","content":"Extrae nombre y precio total de: \"Alice pagó 19.99 EUR\""}
],
"tools":[
{
"type":"function",
"function":{
"name":"extraer_campos",
"description":"Extrae campos estructurados",
"parameters":{
"type":"object",
"properties":{
"nombre":{"type":"string"},
"total":{"type":"number"},
"moneda":{"type":"string"}
},
"required":["nombre","total","moneda"],
"additionalProperties":false
}
}
}
],
"tool_choice":{"type":"function","function":{"name":"extraer_campos"}}
}' | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
messages = @(@{ role="user"; content="Extrae nombre y precio total de: ""Alice pagó 19.99 EUR""" })
tools = @(
@{
type="function"
function=@{
name="extraer_campos"
description="Extrae campos estructurados"
parameters=@{
type="object"
properties=@{
nombre=@{type="string"}
total=@{type="number"}
moneda=@{type="string"}
}
required=@("nombre","total","moneda")
additionalProperties=$false
}
}
}
)
tool_choice = @{ type="function"; function=@{ name="extraer_campos" } }
} | ConvertTo-Json -Depth 50
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
responses: JSON Schema
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"${BASE_URL}/responses" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"'"${MODEL}"'",
"input":"Extrae nombre y precio total de: Alice pagó 19.99 EUR",
"response_format":{
"type":"json_schema",
"json_schema":{
"name":"campos_recibo",
"schema":{
"type":"object",
"properties":{
"nombre":{"type":"string"},
"total":{"type":"number"},
"moneda":{"type":"string"}
},
"required":["nombre","total","moneda"],
"additionalProperties":false
}
}
}
}' | python -m json.tool
PowerShell
$body = @{
model = $env:MODEL
input = "Extrae nombre y precio total de: Alice pagó 19.99 EUR"
response_format = @{
type="json_schema"
json_schema=@{
name="campos_recibo"
schema=@{
type="object"
properties=@{
nombre=@{type="string"}
total=@{type="number"}
moneda=@{type="string"}
}
required=@("nombre","total","moneda")
additionalProperties=$false
}
}
}
} | ConvertTo-Json -Depth 60
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"$env:BASE_URL/responses" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
Procesamiento por lotes y concurrente
Bash: xargs concurrente
printf "%s\n" "q1: hola" "q2: mutex" "q3: semáforo" | \
xargs -P 8 -I {} bash -lc '
curl -sS --fail --connect-timeout 5 --max-time 60 "'"${BASE_URL}"'/chat/completions" \
-H "Authorization: Bearer '"${API_KEY}"'" -H "Content-Type: application/json" \
-d "{\"model\":\"'"${MODEL}"'\",\"messages\":[{\"role\":\"user\",\"content\":\"{}\"}]}" \
| python -c "import sys,json; print(json.load(sys.stdin)[\"choices\"][0][\"message\"][\"content\"])"
'
PowerShell: ForEach-Object -Parallel
$qs = @("q1: hola","q2: mutex","q3: semáforo")
$qs | ForEach-Object -Parallel {
$body = @{
model = $env:MODEL
messages = @(@{role="user"; content=$_})
} | ConvertTo-Json -Depth 10
curl.exe -sS --fail --connect-timeout 5 --max-time 60 `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body
} -ThrottleLimit 8 | Out-String | Write-Host
Carga de archivos (OCR, documentos, tablas)
Cargar directamente PDF/imagen
Bash
export PARSE_URL="http://177.24.2.3:9005/file_parse"
export SERVER_URL="http://177.24.2.3:8000"
curl -sS --fail --connect-timeout 10 --max-time 3600 \
"${PARSE_URL}" \
-F "files=@./informe.pdf" \
-F "backend=vlm-http-client" \
-F "server_url=${SERVER_URL}" \
-F "parse_method=auto" \
-F "formula_enable=true" \
-F "table_enable=true" \
-F "start_page_id=0" \
| python -m json.tool
PowerShell
$PARSE_URL="http://177.24.2.3:9005/file_parse"
$SERVER_URL="http://177.24.2.3:8000"
curl.exe -sS --fail --connect-timeout 10 --max-time 3600 `
"$PARSE_URL" `
-F "files=@informe.pdf" `
-F "backend=vlm-http-client" `
-F "server_url=$SERVER_URL" `
-F "parse_method=auto" `
-F "formula_enable=true" `
-F "table_enable=true" `
-F "start_page_id=0" `
| python -m json.tool
Pipe: Descargar y reenviar
Bash
curl -L "https://www.energy.gov/sites/default/files/2023-01/informe.pdf" \
| curl -sS --fail --connect-timeout 10 --max-time 3600 \
"http://177.24.2.3:9005/file_parse" \
-F "files=@-;filename=informe.pdf" \
-F "backend=vlm-http-client" \
-F "server_url=http://177.24.2.3:8000" \
-F "parse_method=auto" \
-F "formula_enable=true" \
-F "table_enable=true" \
-F "start_page_id=0" \
| python -m json.tool
PowerShell
$tmp = Join-Path $env:TEMP "informe.pdf"
curl.exe -L "https://www.energy.gov/sites/default/files/2023-01/informe.pdf" -o $tmp
curl.exe -sS --fail --connect-timeout 10 --max-time 3600 `
"http://177.24.2.3:9005/file_parse" `
-F "files=@$tmp" `
-F "backend=vlm-http-client" `
-F "server_url=http://177.24.2.3:8000" `
-F "parse_method=auto" `
-F "formula_enable=true" `
-F "table_enable=true" `
-F "start_page_id=0" `
| python -m json.tool
Generación de imágenes (texto a imagen)
/v1/images/generations (Plantilla)
Bash
curl -sS --fail --connect-timeout 10 --max-time 300 \
"${BASE_URL}/images/generations" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"modelo-imagen",
"prompt":"Un diagrama esquemático de una canalización OCR, estilo minimalista",
"size":"1024x1024"
}' | python -m json.tool
PowerShell
$body = @{
model="modelo-imagen"
prompt="Un diagrama esquemático de una canalización OCR, estilo minimalista"
size="1024x1024"
} | ConvertTo-Json -Depth 10
curl.exe -sS --fail --connect-timeout 10 --max-time 300 `
"$env:BASE_URL/images/generations" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body | python -m json.tool
ASR (Reconocimiento de voz) y TTS (Síntesis de voz)
ASR: /v1/audio/transcriptions (multipart)
Bash
curl -sS --fail --connect-timeout 10 --max-time 300 \
"${BASE_URL}/audio/transcriptions" \
-H "Authorization: Bearer ${API_KEY}" \
-F "model=whisper-1" \
-F "file=@./voz.wav" \
-F "language=en" \
| python -m json.tool
PowerShell
curl.exe -sS --fail --connect-timeout 10 --max-time 300 `
"$env:BASE_URL/audio/transcriptions" `
-H "Authorization: Bearer $env:API_KEY" `
-F "model=whisper-1" `
-F "file=@voz.wav" `
-F "language=en" `
| python -m json.tool
TTS: /v1/audio/speech (Guardar en archivo)
Bash
curl -sS --fail --connect-timeout 10 --max-time 300 \
"${BASE_URL}/audio/speech" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-d '{
"model":"tts-1",
"voice":"alloy",
"input":"Hola desde TTS."
}' --output salida.mp3
PowerShell
$body = @{
model="tts-1"
voice="alloy"
input="Hola desde TTS."
} | ConvertTo-Json -Depth 10
curl.exe -sS --fail --connect-timeout 10 --max-time 300 `
"$env:BASE_URL/audio/speech" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-d $body `
--output salida.mp3
Seguridad y observabilidad
Reintentos + mostrar tiempo de ejecución
Bash
curl -sS --fail \
--connect-timeout 10 --max-time 120 \
--retry 5 --retry-all-errors --retry-delay 1 \
-w "\nHTTP=%{http_code} total=%{time_total}s connect=%{time_connect}s\n" \
"${BASE_URL}/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json" \
-H "X-Trace-Id: trace-$(date +%s)" \
-d "{\"model\":\"${MODEL}\",\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}]}"
PowerShell
$trace = "trace-$([DateTimeOffset]::Now.ToUnixTimeSeconds())"
$body = @{ model=$env:MODEL; messages=@(@{role="user"; content="ping"}) } | ConvertTo-Json -Depth 10
curl.exe -sS --fail `
--connect-timeout 10 --max-time 120 `
--retry 5 --retry-all-errors --retry-delay 1 `
-w "`nHTTP=%{http_code} total=%{time_total}s connect=%{time_connect}s`n" `
"$env:BASE_URL/chat/completions" `
-H "Authorization: Bearer $env:API_KEY" `
-H "Content-Type: application/json" `
-H "X-Trace-Id: $trace" `
-d $body
Proxy (HTTP/HTTPS)
Bash
export HTTPS_PROXY="http://127.0.0.1:7890"
curl -sS --fail "${BASE_URL}/models" -H "Authorization: Bearer ${API_KEY}"
PowerShell
$env:HTTPS_PROXY="http://127.0.0.1:7890"
curl.exe -sS --fail "$env:BASE_URL/models" -H "Authorization: Bearer $env:API_KEY"
Servicios de infernecia personalizados (no OpenAI)
Inefrencia con cuerpo JSON
Bash
curl -sS --fail --connect-timeout 10 --max-time 120 \
"http://HOST:PUERTO/inferir" \
-H "Content-Type: application/json" \
-d '{
"modelo":"MODELO",
"entradas":{"texto":"hola"},
"parametros":{"max_new_tokens":128,"temperature":0.2}
}'
PowerShell
$body = @{
modelo="MODELO"
entradas=@{ texto="hola" }
parametros=@{ max_new_tokens=128; temperature=0.2 }
} | ConvertTo-Json -Depth 20
curl.exe -sS --fail --connect-timeout 10 --max-time 120 `
"http://HOST:PUERTO/inferir" `
-H "Content-Type: application/json" `
-d $body
Inferencia con carga multipart
Bash
curl -sS --fail --connect-timeout 10 --max-time 600 \
"http://HOST:PUERTO/inferir_archivo" \
-F "archivo=@./entrada.pdf" \
-F "modelo=MODELO" \
-F "params={\"tabla\":true,\"formula\":true};type=application/json"
PowerShell
curl.exe -sS --fail --connect-timeout 10 --max-time 600 `
"http://HOST:PUERTO/inferir_archivo" `
-F "archivo=@entrada.pdf" `
-F "modelo=MODELO" `
-F "params={""tabla"":true,""formula"":true};type=application/json"
Errores comunes y solución de problemas
- 401 Unauthorized: Token inválido o faltante
- 404 Not Found: Endpoint incorrecto o no disponible
- 413 Payload Too Large: Imagen demasiado grande
- 415 Unsupported Media Type: Tipo de contenido incorrecto
- 429 Too Many Requests: Límite de tasa excedido
- 5xx: Errores del servidor
Tabla de parámetros (general)
temperature: Controla aleatoriedadtop_p: Muestreo de núcleomax_tokens: Límite superior de tokens de salidastop: Secuencia de paradaseed: Valor para resultados reproduciblespresence_penalty/frequency_penalty: Penalización para repeticiónresponse_format/json_schema: Formato estructuradostream=true: Streaming SSEtools/tool_choice: Llamadas a funciones