Skip to main content

AI Gateway

El Deployalo AI Gateway expone una API OpenAI-compatible en:

https://api.deployalo.com/ai/gateway/v1

Sirve para conectar cualquier herramienta que acepte un endpoint base de OpenAI y una API key. Todas las requests usan:

Authorization: Bearer dplo_ai_...

Y el catálogo de modelos disponibles para tu key lo obtienes con:

curl https://api.deployalo.com/ai/gateway/v1/models \
-H "Authorization: Bearer dplo_ai_..."

Cursor​

  1. Abre Cursor Settings → Models.
  2. Activa OpenAI API.
  3. En OpenAI API Key pon tu dplo_ai_....
  4. En OpenAI Base URL (a veces está en "Advanced") pon:
    https://api.deployalo.com/ai/gateway/v1
  5. En el modelo usa alguno de tu catálogo, por ejemplo:
    openai/gpt-4.1

Si Cursor no muestra campo de base URL, puedes usar la opciĂłn Override OpenAI Base URL en la versiĂłn Pro/Business.


Continue.dev​

En tu config.json:

{
"models": [
{
"title": "Deployalo AI Gateway",
"provider": "openai",
"model": "openai/gpt-4.1",
"apiBase": "https://api.deployalo.com/ai/gateway/v1",
"apiKey": "dplo_ai_..."
}
]
}

Cambia model por el que tengas permitido en tu key.


OpenAI SDK (Python)​

from openai import OpenAI

client = OpenAI(
base_url="https://api.deployalo.com/ai/gateway/v1",
api_key="dplo_ai_..."
)

res = client.chat.completions.create(
model="openai/gpt-4.1",
messages=[{"role": "user", "content": "Hola"}]
)
print(res.choices[0].message.content)

Streaming:

for chunk in client.chat.completions.create(
model="openai/gpt-4.1",
messages=[{"role": "user", "content": "Cuéntame un chiste corto"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="")

OpenAI SDK (Node.js)​

import OpenAI from 'openai';

const client = new OpenAI({
baseURL: 'https://api.deployalo.com/ai/gateway/v1',
apiKey: 'dplo_ai_...',
});

const res = await client.chat.completions.create({
model: 'openai/gpt-4.1',
messages: [{ role: 'user', content: 'Hola' }],
});

console.log(res.choices[0].message.content);

LangChain (Python)​

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
model="openai/gpt-4.1",
openai_api_key="dplo_ai_...",
openai_api_base="https://api.deployalo.com/ai/gateway/v1"
)

print(llm.invoke("Hola"))

Claude Code​

La app Claude Code de Anthropic usa directamente la API de Anthropic para su modelo de razonamiento, por lo que no se puede cambiar su endpoint base para que "piense" con Deployalo.

Pero sĂ­ puedes:

  • Pedirle a Claude Code que genere cĂłdigo que consuma el AI Gateway.
  • Crear un MCP server propio que llame a https://api.deployalo.com/ai/gateway/v1/chat/completions y dárselo a Claude Code como herramienta.

Ejemplo de llamada desde un script que Claude Code te genere:

curl https://api.deployalo.com/ai/gateway/v1/chat/completions \
-H "Authorization: Bearer dplo_ai_..." \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4.1",
"messages": [{"role": "user", "content": "Resume este texto"}]
}'

Otras herramientas compatibles​

Cualquiera que soporte OpenAI-compatible custom endpoint:

  • OpenCat
  • LobeChat
  • NextChat (ChatGPT-Next-Web)
  • ChatX
  • AnythingLLM (provider de OpenAI)
  • Dify (provider OpenAI-API-compatible)

Configura siempre:

Base URL: https://api.deployalo.com/ai/gateway/v1
API Key: dplo_ai_...
Model: <uno de tu catálogo>

Headers de trazabilidad​

Toda respuesta incluye headers Ăştiles:

X-AI-Request-Id:                 <uuid del request>
X-AI-Key-Id: <id de la key usada>
X-AI-Upstream: openrouter | together
X-AI-Tokens-Input: <tokens de entrada>
X-AI-Tokens-Output: <tokens de salida>
X-AI-Tokens-Cache-Read: <cache read>
X-AI-Tokens-Cache-Write: <cache write>
X-AI-Search-Ops: <bĂşsquedas>
X-AI-Cost-USD-Cents: <costo en cents>
X-AI-Wallet-Balance-USD-Cents: <saldo restante>

Endpoints de utilidad​

EndpointDescripciĂłn
GET /ai/gateway/v1/meInfo de la key + wallet
GET /ai/gateway/v1/modelsCatálogo filtrado a modelos permitidos
GET /ai/gateway/v1/walletSaldo, bolsa y vigencia
GET /ai/gateway/v1/usageConsumo desglosado
POST /ai/gateway/v1/chat/completionsChat completions OpenAI-compatible