Skip to content

External Integrations

Juca connects to several external services. This page documents how to configure each one.

Valter is Juca’s primary backend agent, providing STJ jurisprudence search, citation verification, and knowledge graph analysis.

SettingValue
Base URLhttps://valter-api-production.up.railway.app
AuthX-API-Key header
Env varsVALTER_API_URL, VALTER_API_KEY

Key endpoints consumed by Juca:

EndpointMethodUsed For
/v1/retrievePOSTJurisprudence search (Briefing F1, F2)
/v1/verifyPOSTCitation verification
/v1/graph/optimal-argumentPOSTAdversarial analysis (Briefing F3)
/v1/graph/divergenciasGET/POSTMinister divergences (Briefing F3)
/v1/similar_casesPOSTSimilar case search (Briefing F2)
/healthGETHealth check (should return 200)

Verify connectivity:

Terminal window
curl -H "X-API-Key: $VALTER_API_KEY" \
https://valter-api-production.up.railway.app/health

Each provider requires its own API key. These are transitional — LLM processing is moving to Valter.

ProviderEnv VariableModelsSign Up
AnthropicANTHROPIC_API_KEYClaude Sonnet 4, Opus 4, Haiku 3.5console.anthropic.com
OpenAIOPENAI_API_KEYGPT-5.x, o3, o1, GPT-4.1platform.openai.com
GoogleGEMINI_API_KEYGemini 2.5 Flash/Proaistudio.google.com
GroqGROQ_API_KEYQwen 3 32B, Llama 3.3 70Bconsole.groq.com
DeepSeekDEEPSEEK_API_KEYDeepSeek R1, Chatplatform.deepseek.com
  1. Go to Google Cloud Console → APIs & Services → Credentials
  2. Create OAuth 2.0 client ID (Web application)
  3. Add authorized redirect URI: {NEXT_PUBLIC_APP_URL}/api/auth/callback/google
  4. Set GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET
  1. Sign up at resend.com
  2. Create an API key
  3. Verify your sending domain
  4. Set RESEND_API_KEY and AUTH_EMAIL_FROM

For direct KG access (being replaced by Valter API):

EnvironmentSetup
Local devdocker compose up -d (starts Neo4j Community 5)
ProductionNeo4j Aura Free tier — set NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD

Enable with KG_PROVIDER=neo4j (default is json for local JSON files).

OTel tracing is opt-in. Configure via:

Terminal window
OTEL_EXPORTER_OTLP_ENDPOINT=https://your-otel-collector.example.com
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer your-token

Tracing is initialized in src/instrumentation.ts on server startup.

Juca is deployed on Railway with automatic deploys from the main branch:

  • Docker-based deployment using the multi-stage Dockerfile
  • Persistent volume for SQLite data (sessions, blocks)
  • Environment variables configured in the Railway dashboard
  • Health check endpoint: /api/health