Endpoint de Modelos
La API de Modelos te permite:
- descubrir los IDs de modelos disponibles y sus configuraciones
- ejecutar una ejecución de modelo por solicitud
Ruta base:
https://armox.ai/api/v1/models
GET /api/v1/models
Devuelve todos los modelos disponibles y sus metadatos de configuración.
Solicitud
curl -X GET "https://armox.ai/api/v1/models" \
-H "Authorization: Bearer sk_live_your_key_here"
Respuesta
Prompt Template
{ "object": "list", "data": [ { "id": "google/nano-banana", "name": "Nano Banana", "modality": "image", "cost": 70, "inputTypes": ["text", "image"], "promptRequired": true, "outputType": "image", "description": "Google image generation and editing model", "settings": [ { "key": "aspect_ratio", "label": "Aspect Ratio", "inputType": "select", "defaultValue": "1:1" } ] } ] }
POST /api/v1/models/run
Ejecuta una generación de modelo.
Cuerpo de la Solicitud
Prompt Template
{ "model": "google/nano-banana", "input": { "prompt": "string", "image_input": ["https://example.com/image.jpg"] }, "webhook_url": "https://your-app.com/webhooks/armox" }
Campos:
model(obligatorio): ID del modelo obtenido deGET /api/v1/modelsinput(objeto opcional): entradas y configuraciones específicas del modelowebhook_url(opcional): URL de callback para eventos de finalización
Comportamiento Síncrono vs Asíncrono
POST /models/run puede devolver:
200para completación síncrona (típicamente salidas de imagen/texto/herramientas)202para procesamiento asíncrono (salidas de video/audio/3D)
Ejemplo: Ejecución de Modelo de Imagen (Síncrono)
Solicitud
Prompt Template
curl -X POST "https://armox.ai/api/v1/models/run" \ -H "Authorization: Bearer sk_live_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "model": "google/nano-banana", "input": { "prompt": "Turn this into a cinematic night street photo with neon signs and reflections.", "image_input": ["https://example.com/reference-image.jpg"], "aspect_ratio": "match_input_image", "output_format": "png" } }'
Respuesta típica 200
{
"id": "a1b2c3d4-e5f6-7890-ab12-34567890abcd",
"object": "job",
"status": "completed",
"model": "google/nano-banana",
"output": {
"outputImage": "https://storage.example.com/public/api-outputs/..."
},
"error": null,
"credits_charged": 70,
"created_at": "2026-03-26T12:00:00.000Z",
"completed_at": "2026-03-26T12:00:03.000Z"
}
Ejemplo: Ejecución de Modelo de Video (Asíncrono)
Solicitud
curl -X POST "https://armox.ai/api/v1/models/run" \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "xai/grok-video-image-to-video",
"input": {
"prompt": "Animate this image with smooth camera movement and subtle environmental motion.",
"image_input": "https://example.com/reference-image.jpg",
"duration": 4
}
}'
Respuesta típica 202
{
"id": "f1e2d3c4-b5a6-7890-cd12-34567890efab",
"object": "job",
"status": "processing",
"model": "xai/grok-video-image-to-video",
"credits_charged": 202,
"created_at": "2026-03-26T12:10:00.000Z"
}
Luego consulta:
curl -X GET "https://armox.ai/api/v1/jobs/f1e2d3c4-b5a6-7890-cd12-34567890efab" \
-H "Authorization: Bearer sk_live_your_key_here"
Ejemplo en JavaScript
const response = await fetch("https://armox.ai/api/v1/models/run", {
method: "POST",
headers: {
Authorization: "Bearer sk_live_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "google/nano-banana",
input: {
prompt: "High-end product photo on clean white background",
},
}),
});
const job = await response.json();
console.log(job);
Ejemplo en Python
import requests
response = requests.post(
"https://armox.ai/api/v1/models/run",
headers={
"Authorization": "Bearer sk_live_your_key_here",
"Content-Type": "application/json",
},
json={
"model": "google/nano-banana",
"input": {"prompt": "High-end product photo on clean white background"},
},
)
print(response.status_code)
print(response.json())
Errores que Debes Manejar
400payload inválido o modelo inválido401clave API faltante/inválida402créditos insuficientes403acceso restringido por suscripción429límite de tasa excedido
Consulta los detalles completos: Errores y Límites de Tasa