Skip to main content

Proxy Server that converts llm request format from one provider to another

Project description

LLM Proxy

Overview

llm-proxy-gateway is a small FastAPI service that accepts requests in different LLM API formats and converts them into the OpenAI Responses API format.

Right now, the project supports these endpoint styles:

  • OpenAI Chat Completions API
  • OpenAI Responses API
  • Claude Messages API

The upstream OpenAI call is always made with streaming enabled. The proxy can return either a normal response or a streamed response based on the incoming request.

Installation

  1. Make sure you have uv installed.
  2. Create a .env file in the project root or export variables like startup.sh.
  3. Add your configuration values.
  4. Install dependencies.
  5. Start the server.

Example .env file:

LLM_PROVIDER=OPENAI
API_SERVER_PORT=11434
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4
OPENAI_BASE_URL=https://api.openai.com/v1

Install dependencies:

uv sync

Start the server:

./startup.sh

Or run directly:

uv run llm-proxy-gateway

Sample Request

Health check:

GET http://localhost:11434/health

OpenAI Chat Completions request:

POST http://localhost:11434/v1/chat/completions
Content-Type: application/json

{
  "model": "oca/gpt5",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ]
}

OpenAI Responses request:

POST http://localhost:11434/v1/responses
Content-Type: application/json

{
  "model": "oca/gpt5",
  "input": "Reply with the word OK if you can read this.",
  "stream": false
}

Claude Messages request:

POST http://localhost:11434/v1/messages
Content-Type: application/json

{
  "model": "oca/gpt5",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Hello Claude, reply with a short greeting."
    }
  ]
}

You can also use the ready-made examples in test.http.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_proxy_gateway-0.0.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_proxy_gateway-0.0.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file llm_proxy_gateway-0.0.1.tar.gz.

File metadata

  • Download URL: llm_proxy_gateway-0.0.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for llm_proxy_gateway-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c3598e10bc9f4afb6f9eb9f623bfb9f189dbdc06d3dca183f83be2a78d7649ce
MD5 4f4e346546ff3245f4e0499bd99ddba5
BLAKE2b-256 7b379519417cf3776ce436d79374d3b34025f7fea0ae73f6c82cbd9b559bd227

See more details on using hashes here.

File details

Details for the file llm_proxy_gateway-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_proxy_gateway-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f687df738fe002bfe52fdcfe7486ae59532c75f4c5e6b993801266eeab789834
MD5 65f9d3d7dd7276f6b403d3f71ed41590
BLAKE2b-256 c18e3ca7b0ece0a0fc651a086511711b0065396d2612b91e5ed7b404bd53a0f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page