Spaces:
Sleeping
Sleeping
Delete README.md
Browse files
README.md
DELETED
|
@@ -1,119 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: GLM-4.6V-Flash API
|
| 3 |
-
emoji: 🤖
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
app_port: 7860
|
| 9 |
-
---
|
| 10 |
-
|
| 11 |
-
# GLM-4.6V-Flash — OpenAI-Compatible API
|
| 12 |
-
|
| 13 |
-
**GLM-4.6V-Flash 9B** con visión nativa, 128K contexto y tool calling.
|
| 14 |
-
Corre en CPU puro — tier gratuito de HF Spaces (16 GB RAM).
|
| 15 |
-
|
| 16 |
-
---
|
| 17 |
-
|
| 18 |
-
## Endpoint
|
| 19 |
-
|
| 20 |
-
```
|
| 21 |
-
POST https://<tu-user>-glm-flash-api.hf.space/v1/chat/completions
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-
## Ejemplos de uso
|
| 25 |
-
|
| 26 |
-
### Chat básico
|
| 27 |
-
```bash
|
| 28 |
-
curl https://<tu-user>-glm-flash-api.hf.space/v1/chat/completions \
|
| 29 |
-
-H "Content-Type: application/json" \
|
| 30 |
-
-d '{
|
| 31 |
-
"model": "GLM-4.6V-Flash",
|
| 32 |
-
"messages": [{"role": "user", "content": "Hola, respondé en español"}],
|
| 33 |
-
"max_tokens": 512,
|
| 34 |
-
"temperature": 0.7
|
| 35 |
-
}'
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
### Con imagen (visión)
|
| 39 |
-
```json
|
| 40 |
-
{
|
| 41 |
-
"model": "GLM-4.6V-Flash",
|
| 42 |
-
"messages": [{
|
| 43 |
-
"role": "user",
|
| 44 |
-
"content": [
|
| 45 |
-
{"type": "text", "text": "¿Qué muestra esta imagen?"},
|
| 46 |
-
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/..."}}
|
| 47 |
-
]
|
| 48 |
-
}]
|
| 49 |
-
}
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
### Tool calling (agente)
|
| 53 |
-
```json
|
| 54 |
-
{
|
| 55 |
-
"model": "GLM-4.6V-Flash",
|
| 56 |
-
"messages": [{"role": "user", "content": "¿Cuánto es 15% de 3400?"}],
|
| 57 |
-
"tools": [{
|
| 58 |
-
"type": "function",
|
| 59 |
-
"function": {
|
| 60 |
-
"name": "calcular",
|
| 61 |
-
"description": "Realiza un cálculo matemático",
|
| 62 |
-
"parameters": {
|
| 63 |
-
"type": "object",
|
| 64 |
-
"properties": {
|
| 65 |
-
"expresion": {"type": "string"}
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
}
|
| 69 |
-
}]
|
| 70 |
-
}
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
---
|
| 74 |
-
|
| 75 |
-
## Variables de entorno (Settings → Variables en HF Spaces)
|
| 76 |
-
|
| 77 |
-
| Variable | Default | Descripción |
|
| 78 |
-
|---|---|---|
|
| 79 |
-
| `CONTEXT_SIZE` | `8192` | Tokens de contexto activo |
|
| 80 |
-
| `NUM_THREADS` | `2` | Hilos CPU (límite del free tier) |
|
| 81 |
-
| `MAX_TOKENS` | `1024` | Tokens máximos por respuesta |
|
| 82 |
-
|
| 83 |
-
---
|
| 84 |
-
|
| 85 |
-
## Conexión desde n8n
|
| 86 |
-
|
| 87 |
-
Nodo **HTTP Request**:
|
| 88 |
-
- **Method:** POST
|
| 89 |
-
- **URL:** `https://<tu-user>-glm-flash-api.hf.space/v1/chat/completions`
|
| 90 |
-
- **Headers:** `Content-Type: application/json`
|
| 91 |
-
- **Body (JSON):**
|
| 92 |
-
```json
|
| 93 |
-
{
|
| 94 |
-
"model": "GLM-4.6V-Flash",
|
| 95 |
-
"messages": [
|
| 96 |
-
{"role": "system", "content": "Sos un asistente. Respondé siempre en JSON válido."},
|
| 97 |
-
{"role": "user", "content": "{{ $json.message }}"}
|
| 98 |
-
],
|
| 99 |
-
"max_tokens": 512,
|
| 100 |
-
"temperature": 0.3
|
| 101 |
-
}
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
---
|
| 105 |
-
|
| 106 |
-
## Keep-alive (evitar cold starts)
|
| 107 |
-
|
| 108 |
-
Crear workflow en n8n:
|
| 109 |
-
- **Trigger:** Schedule cada 9 minutos
|
| 110 |
-
- **Nodo HTTP GET:** `https://<tu-user>-glm-flash-api.hf.space/health`
|
| 111 |
-
|
| 112 |
-
---
|
| 113 |
-
|
| 114 |
-
## Notas importantes
|
| 115 |
-
|
| 116 |
-
- ⚠️ **Primer arranque:** descarga ~8.1 GB (modelo + mmproj). Esperar 10-15 min.
|
| 117 |
-
- ⚠️ **Disco no persistente:** si el Space se reinicia, vuelve a descargar.
|
| 118 |
-
- 💡 El keep-alive previene reinicios en uso activo.
|
| 119 |
-
- 🔒 Para modelos privados, agregar `HF_TOKEN` en Settings → Secrets.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|