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.3.tar.gz (9.8 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.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llm_proxy_gateway-0.0.3.tar.gz
Algorithm Hash digest
SHA256 7401dc605b721a3d7839a073b07f8800700a805cdcd317c8ebc7e4a56208bee5
MD5 cb1fc52cc0842007d247884b67f3ade7
BLAKE2b-256 bc61d9d05c672f08f155badc1d8f02fdb15494cd7500f3751bcbd9f1a1d762ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm_proxy_gateway-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2e306dd622a3a876c81dffc38959c301e0f05556d9c4776820273e6b7730d3d8
MD5 cc5ce16de852c5d63c777922a7108b47
BLAKE2b-256 9c1019f5d7809ad21d515c5b251515604162b6e606a5c3e923ab1dd3864d9438

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