Quick Start

Get InferXgate up and running in under 5 minutes with Docker.

This guide will help you get InferXgate running in just a few minutes using Docker.

Prerequisites

Before you begin, make sure you have:

  • Docker and Docker Compose installed
  • At least one LLM API key (Anthropic, OpenAI, or Google Gemini)

Step 1: Clone the Repository

git clone https://github.com/jasmedia/inferxgate.git
cd inferxgate

Step 2: Configure Environment

Copy the example environment file:

cp .env.example .env

Edit .env and add your API keys:

# Required: Add at least one provider API key
ANTHROPIC_API_KEY=sk-ant-your-key-here
OPENAI_API_KEY=sk-your-key-here
GEMINI_API_KEY=your-gemini-key-here

# Database (uses default Docker settings)
DATABASE_URL=postgresql://postgres:postgres@db:5432/inferxgate

# Redis for caching (uses default Docker settings)
REDIS_URL=redis://redis:6379

# JWT Secret (generate a secure random string)
JWT_SECRET=your-secure-secret-key-here

Step 3: Start the Services

docker-compose up -d

This starts:

  • InferXgate API on port 3000
  • Dashboard on port 80
  • PostgreSQL database
  • Redis cache

Step 4: Verify Installation

Check that the services are running:

# Health check
curl http://localhost:3000/health

You should see:

{
  "status": "healthy",
  "version": "1.0.0"
}

Step 5: Make Your First Request

Use the OpenAI SDK or curl to make a request:

Using Python

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:3000/v1",
    api_key="your-api-key"  # Or use JWT token
)

response = client.chat.completions.create(
    model="claude-3-opus-20240229",  # Or gpt-4, gemini-1.5-pro
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

Using cURL

curl -X POST http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key" \
  -d '{
    "model": "claude-3-opus-20240229",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Step 6: Access the Dashboard

Open your browser and go to:

http://localhost

The dashboard provides:

  • Real-time usage statistics
  • Interactive API playground
  • Provider management
  • API key management

Model Naming Convention

InferXgate routes requests based on model names:

PrefixProvider
claude-*Anthropic
gpt-*OpenAI
gemini-*Google Gemini
azure-*Azure OpenAI

Examples:

  • claude-3-opus-20240229 → Anthropic
  • gpt-4-turbo → OpenAI
  • gemini-1.5-pro → Google Gemini

What’s Next?

Now that you have InferXgate running:

Troubleshooting

Port Already in Use

If port 3000 is already in use, modify the port mapping in docker-compose.yml:

ports:
  - "3001:3000"  # Use port 3001 instead

Container Won’t Start

Check the logs:

docker-compose logs -f inferxgate

Database Connection Error

Ensure PostgreSQL is running and the DATABASE_URL is correct:

docker-compose ps
docker-compose logs db

Cache Not Working

Verify Redis is running:

docker-compose logs redis
redis-cli -h localhost ping