33800 Docs

← Retour

Anthropic API Integration + Cost Tracking

Date : 14/02/2026 Status : TERMINE Projets : ai-orchestrator, ulias-org Commits : 80c546a (ai-orchestrator), 4af3857 (ulias-org)


Objectif

Integrer l'API Anthropic Claude dans ai-orchestrator comme provider LLM cloud pour les agents ulias-org qui font du tool-use complexe. Garder le local (Ollama) pour les taches legeres. Tracker les couts en temps reel.

Ce qui a ete fait

ai-orchestrator

Nouveau tool "anthropic"

Convertisseurs format Ollama <-> Anthropic

Fonctions d'execution

Cost tracking

Budget guard

Endpoints API

Worker

Config

ulias-org

Provider routing

Agents assignes a Anthropic (12)

Agents avec tools complexes = provider: 'anthropic' :

Agents restes en local (19)

Agents sans tools ou taches simples :

Securite

Migration SQL executee

ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS cost_usd NUMERIC(10,6) DEFAULT 0;
ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS provider TEXT DEFAULT 'local';
ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS tokens_input INTEGER DEFAULT 0;
ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS tokens_output INTEGER DEFAULT 0;
ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS cache_read_tokens INTEGER DEFAULT 0;
ALTER TABLE ai_jobs ADD COLUMN IF NOT EXISTS cache_creation_tokens INTEGER DEFAULT 0;

Tests effectues

Test Resultat
GET /api/costs/live OK - retourne today/month par provider, budget, alerte
GET /api/costs/summary?year=2026&month=2 OK - 304k jobs locaux, 0$ anthropic
Tool "anthropic" dans /api/tools OK - enregistre, gpu_id=-1, port=0
Schema /api/tools/schemas/anthropic OK - chat + batch job_types
ulias-org health OK - 31 agents, healthy
AI-orchestrator health OK - healthy apres redeploy

Activation future

Pour activer Anthropic :

  1. Obtenir une cle API sur console.anthropic.com
  2. Mettre la cle dans conf.prod.gouroubleu.yml : ANTHROPIC_API_KEY: "sk-ant-..."
  3. Redeploy ai-orchestrator (push ou smart-deploy)
  4. Les agents tool-heavy basculent automatiquement sur Claude
  5. Monitorer les couts via /api/costs/live

Fichiers modifies

Fichier Lignes
ai-orchestrator/app/main.py +592 -24
ai-orchestrator/conf.prod.gouroubleu.yml +2
ulias-org/packages/server/src/tools/client.ts +22 -10
ulias-org/packages/server/src/agents/registry.ts +17 -8
ulias-org/packages/server/src/agent-runner/index.ts +2
ulias-org/packages/server/src/director/index.ts +1
DB ai_jobs +6 colonnes