A lightweight proxy server for making authenticated requests to the Jina AI API. This server helps handle CORS issues and securely manages API keys when making requests to Jina's services.
- Proxies requests to Jina AI API
- Handles CORS
- Secure API key management
- JSON and text response handling
- Docker support
- Node.js 18 or higher
- Docker (optional)
- Jina AI API key
- Clone the repository
- Create a
.env
file in the root directory with:JINA_API_KEY=your_api_key_here PORT=3000 # optional, defaults to 3000
- Install dependencies:
npm install
npm start
Build and run with Docker:
npm run docker:start
Or build and run separately:
npm run docker:build
npm run docker:run
POST /deepsearch/chat
Handle complex queries with Jina's DeepSearch API supporting streaming responses and adjustable reasoning effort. The server automatically adds your Jina API key for authentication.
Example Request:
curl -X POST http://localhost:3000/deepsearch/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "What's the latest blog post from Jina AI?"}
],
"stream": true,
"reasoning_effort": "medium"
}'
Parameters:
messages
: Array of message objects with role (user/assistant) and contentmodel
: DeepSearch model version (default: jina-deepsearch-v1)stream
: Enable Server-Sent Events (SSE) streaming (default: true)reasoning_effort
: Processing intensity level (low/medium/high)
Response:
- Streaming (text/event-stream): Real-time SSE events with data chunks
- Non-streaming (application/json): Standard JSON response with complete answer
GET /read?url=<encoded-url>
Makes a proxied request to the Jina AI API. The Jina AI API can be used for various document processing tasks:
-
Document Reading & Analysis
- Extract text from PDFs, Word documents, and images
- Parse structured data from documents
- Convert documents to different formats
-
Web Scraping & Processing
- Extract content from web pages
- Process HTML content
- Parse news articles and blog posts
-
Content Extraction
- Extract tables from documents
- Pull specific sections or paragraphs
- Identify headers and metadata
-
Document Intelligence
- Analyze document layout
- Extract key-value pairs
- Identify document types
Example Request:
# Extract content from a PDF
curl "http://localhost:3000/read?url=https://example.com/document.pdf"
# Process a webpage
curl "http://localhost:3000/read?url=https://news-article.com/story"
# Extract tables from a document
curl "http://localhost:3000/read?url=https://example.com/report.xlsx"
Response formats vary based on the document type and processing requested. The server handles both JSON and text responses appropriately.
The server provides appropriate error responses for:
- Missing URL parameters
- API authentication issues
- Invalid responses
- Server errors
- API keys are stored securely in environment variables
- CORS is enabled for cross-origin requests
- Sensitive information is not exposed to clients
MIT