GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jmkraus/FMProxy: A simple PoC proxy server for using Apple Foundation Model with OpenAI API structure

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
FMProxy.xcodeproj
FMProxy.xcodeproj
 
 
FMProxy
FMProxy
 
 
FMProxyTests
FMProxyTests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sh
build.sh
 
 

Repository files navigation

FMProxy

A lightweight, local OpenAI-compatible API proxy for Apple Foundation Models.

Features

  • OpenAI-compatible POST /v1/chat/completions
  • Streaming and non-streaming responses
  • Text and base64-encoded image input
  • Structured output with json_object and json_schema
  • Optional JSON Schema validation
  • No API keys or external services required

Requirements

  • macOS 27.0 or later
  • Apple Silicon Mac with Apple Foundation Models available
  • Xcode with the macOS 27 SDK

Build

Build with Xcode:

xcodebuild \
  -project FMProxy.xcodeproj \
  -scheme FMProxy \
  -configuration Release \
  build

Or use the build script:

./build.sh

This creates fmproxy-bin in the repository root.

Run

./fmproxy-bin

The server listens on 127.0.0.1:8080 by default.

./fmproxy-bin --host 127.0.0.1 --port 8080

Options

Option Default Description
--host <host> 127.0.0.1 Address to bind to
--port <port> 8080 Port to listen on
--no-logs — Disable request logging
--validate-structured-output disabled Validate JSON Schema responses
--help, -h — Show help

API

Endpoints

  • GET /health
  • GET /v1/models
  • POST /v1/chat/completions

Text completion

curl http://127.0.0.1:8080/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "apple-foundation-model",
    "messages": [
      {"role": "user", "content": "Explain Swift in one sentence."}
    ]
  }'

Set "stream": true to receive an OpenAI-compatible Server-Sent Events response.

Image input

Images are accepted as OpenAI-style image_url content parts. Use a base64 data URL:

curl http://127.0.0.1:8080/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "apple-foundation-model",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What is in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/png;base64,<base64-data>"
          }
        }
      ]
    }]
  }'

Supported image data URLs use the data:image/...;base64,... format. Remote image URLs are not downloaded.

Structured output

Use the OpenAI-compatible response_format field with json_object or json_schema:

{
  "model": "apple-foundation-model",
  "messages": [
    {"role": "user", "content": "Return a person named Ada."}
  ],
  "response_format": {
    "type": "json_object"
  }
}

Limits

  • Maximum request body: 10 MiB
  • Maximum headers: 64 KiB
  • Request timeout: 30 seconds
  • Chunked transfer encoding is not supported

Tests

xcodebuild \
  -project FMProxy.xcodeproj \
  -scheme FMProxy \
  -configuration Debug \
  CODE_SIGNING_ALLOWED=NO \
  test

Related Projects

  • tucats/fmProxy
  • gregbarbosa/fm-proxy
  • shibukawa/fmproxy
  • 1duo/apple-fm-serve

License

See LICENSE.

About

A simple PoC proxy server for using Apple Foundation Model with OpenAI API structure

Topics

aiai-toolsapple-siliconfoundation-modelsmacos

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.