Docs
cURL

cURL

Exemplos de requisições com cURL para testar a API rapidamente.

O cURL é ideal para testar a API rapidamente no terminal ou em scripts shell.

Configuração

Exporte sua API key como variável de ambiente:

export IGNUS_API_KEY="sk_ic_xxxxxxxxxxxxxxxxxxxx"

Chat Completion básico

curl https://proxy.ignustec.com.br/v1/chat/completions \
  -H "Authorization: Bearer $IGNUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Qual é a capital do Brasil?"}
    ]
  }'

Com system prompt

curl https://proxy.ignustec.com.br/v1/chat/completions \
  -H "Authorization: Bearer $IGNUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4",
    "messages": [
      {"role": "system", "content": "Você é um assistente técnico especializado em Python."},
      {"role": "user",   "content": "Como faço um decorator em Python?"}
    ],
    "temperature": 0.5,
    "max_tokens": 512
  }'

Com streaming

curl https://proxy.ignustec.com.br/v1/chat/completions \
  -H "Authorization: Bearer $IGNUS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  --no-buffer \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Escreva um haiku sobre programação."}],
    "stream": true
  }'

Listar modelos disponíveis

curl https://proxy.ignustec.com.br/v1/models \
  -H "Authorization: Bearer $IGNUS_API_KEY"

Formatar a saída com jq

curl -s https://proxy.ignustec.com.br/v1/chat/completions \
  -H "Authorization: Bearer $IGNUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.3-70b",
    "messages": [{"role": "user", "content": "Olá!"}]
  }' | jq '.choices[0].message.content'

Script shell completo

ask.sh
#!/bin/bash
 
# Uso: ./ask.sh "sua pergunta aqui"
PERGUNTA="$1"
 
curl -s https://proxy.ignustec.com.br/v1/chat/completions \
  -H "Authorization: Bearer $IGNUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"gpt-4o-mini\",
    \"messages\": [{\"role\": \"user\", \"content\": \"$PERGUNTA\"}]
  }" | jq -r '.choices[0].message.content'
chmod +x ask.sh
./ask.sh "O que é machine learning?"