Internal API
Developer Docs

API Documentation

Internal API reference for developers integrating with SOHAM or self-hosting the platform. Base URL: https://soham-ai.vercel.app

No Public API Key System

SOHAM does not currently offer a public API key system. These endpoints are used internally by the web app. For direct integration, use the web app at https://soham-ai.vercel.app. For self-hosting, see the GitHub repository.

Chat Direct

POST
/api/chat-direct

Send a message to the AI and receive a response. Supports conversation history and per-request settings.

Parameters

NameTypeRequiredDescription
messagestring
required
The user's message
historyarray
optional
Previous messages [{role, content}]
settings.modelstring
optional
"auto" or a specific model ID
settings.tonestring
optional
"helpful" | "formal" | "casual"
settings.technicalLevelstring
optional
"beginner" | "intermediate" | "expert"

Request

POST /api/chat-direct
Content-Type: application/json

{
  "message": "Explain how async/await works in JavaScript",
  "history": [
    {
      "role": "user",
      "content": "What are Promises?"
    },
    {
      "role": "assistant",
      "content": "Promises represent the eventual result of an async operation..."
    }
  ],
  "settings": {
    "model": "auto",
    "tone": "helpful",
    "technicalLevel": "intermediate"
  }
}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": "async/await is syntactic sugar built on top of Promises...",
  "model": "llama-3.1-8b-instant",
  "provider": "groq"
}

PDF Analyzer

POST
/api/ai/pdf-analyzer

Upload a PDF (up to 5MB) and ask a question about its contents. Send as multipart/form-data.

Parameters

NameTypeRequiredDescription
fileFile
required
PDF file, max 5MB
querystring
required
Question to ask about the PDF

Request

POST /api/ai/pdf-analyzer
Content-Type: multipart/form-data

file: <PDF binary, max 5MB>
query: "What are the main conclusions of this paper?"

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "answer": "The paper concludes that...",
  "pages": 12,
  "model": "gemini-2.5-flash"
}

Web Search

POST
/api/ai/search

Perform a DuckDuckGo web search and receive summarised results.

Parameters

NameTypeRequiredDescription
querystring
required
Search query string

Request

POST /api/ai/search
Content-Type: application/json

{
  "query": "Next.js 15 new features"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "results": [
    {
      "title": "Next.js 15 Release Notes",
      "url": "https://nextjs.org/blog/next-15",
      "snippet": "Next.js 15 introduces React 19 support, Turbopack..."
    }
  ],
  "summary": "Next.js 15 brings React 19 support, stable Turbopack..."
}

Self-Hosting

SOHAM is open-source and self-hostable

Clone the repository, add your own API keys for Groq, HuggingFace, and Google AI in .env.local, and deploy to Vercel, Netlify, or any Node.js host.

git clone https://github.com/heoster/soham-ai

cd soham-ai

cp .env.local.example .env.local

npm install && npm run dev