Add NEAR AI chat-api as default LLM provider

Adds NearAiProvider that uses the NEAR AI unified API at
api.near.ai/v1/responses with session token authentication.
This provides access to multiple models (OpenAI, Anthropic, etc.)
through a single endpoint with user auth and usage tracking.

- Add src/llm/nearai.rs with complete provider implementation
- Add NearAiConfig to config.rs with session_token, model, base_url
- Add NearAi variant to LlmProvider enum (accepts nearai/near-ai/near_ai)
- Change default provider from OpenAi to NearAi
- Update .env.example with NEAR AI configuration
- Update CLAUDE.md documentation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-02-02 21:26:39 -08:00
co-authored by Claude Opus 4.5
parent e30db26bfe
commit f29892b3fb
5 changed files with 437 additions and 6 deletions
+12 -2
View File
@@ -3,13 +3,23 @@ DATABASE_URL=postgres://near_agent:password@localhost:5432/near_agent
DATABASE_POOL_SIZE=10
# LLM Providers
# Default is NEAR AI which provides a unified interface to all models
# NEAR AI (recommended - unified API with user authentication)
NEARAI_SESSION_TOKEN=sess_...
NEARAI_MODEL=claude-3-5-sonnet-20241022
NEARAI_BASE_URL=https://api.near.ai
# OpenAI (alternative)
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4-turbo-preview
# Anthropic (alternative)
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-3-opus-20240229
# Default LLM provider: openai or anthropic
LLM_PROVIDER=openai
# Default LLM provider: nearai, openai, or anthropic
LLM_PROVIDER=nearai
# Channel Configuration
# CLI is always enabled