Skip to content

Instantly share code, notes, and snippets.

View marvs's full-sized avatar
🏠
Working from home

Marvin Baltazar marvs

🏠
Working from home
View GitHub Profile
@marvs
marvs / local_openai_server.py
Created April 14, 2026 14:16
Simple Python script that wraps a local LLM with an OpenAI-compatible API
import json
import os
import re
import time
import uuid
from threading import Thread
from typing import Any, Dict, List, Optional
from fastapi import FastAPI, Header, HTTPException
from fastapi.responses import JSONResponse, StreamingResponse