Skip to content

p1atdev/Fameuse

Repository files navigation

🍎 Fameuse - Foundation Model Use

English | 日本語

A CLI tool to serve Apple Foundation Models via an OpenAI API-compatible interface.

Features

Exposes Apple Foundation Models as OpenAI API-compatible endpoints with streaming support.

Supported Endpoints

Endpoint Method Description
/v1/models GET List available models
/v1/models/:model_id GET Get model details
/v1/chat/completions POST Chat-based text generation
/v1/completions POST Text completion
/v1/responses POST Responses API

Supported Parameters

  • temperature - Sampling randomness
  • top_p - Top-p sampling
  • max_tokens / max_output_tokens - Maximum number of tokens
  • seed - Seed for reproducibility
  • stream - Enable streaming responses
  • response_format - Structured output (json_schema, json_object)

Authentication

Bearer token authentication is supported. When an API key is configured, all requests must include a valid Authorization: Bearer <api_key> header.

If no API key is configured, all requests are allowed without authentication.

Installation

Homebrew

brew tap p1atdev/tap
brew install fameuse

Build from Source

  • Recommended: macOS Tahoe 26.4 or later
  • Required: macOS Tahoe 26.0 or later
  • Swift >= 6.2
git clone https://github.com/p1atdev/Fameuse
cd Fameuse
swift build -c release

Binary path: ./.build/release/fameuse

Usage

Starting the Server

fameuse serve

Starts on 127.0.0.1:8084 by default.

Option Short Default Description
--host -h 127.0.0.1 Host address to bind
--port -p 8084 Port to listen on
--api-key API key for authentication

You can also set the API key via environment variable:

export FAMEUSE_API_KEY="your-secret-key"
fameuse serve
fameuse serve --host 0.0.0.0 --port 8080 --api-key "your-secret-key"

Quick Start with curl

  • List models:
curl http://127.0.0.1:8084/v1/models
{
  "object": "list",
  "data": [
    {
      "id": "apple-foundation-model",
      "object": "model",
      "owned_by": "apple",
      "context_window": 4096
    }
  ]
}
  • Chat completion:
curl -X POST http://127.0.0.1:8084/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "apple-foundation-model",
    "messages": [{"role": "user", "content": "Say hello in one word."}]
  }'
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "apple-foundation-model",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "Hi."},
      "finish_reason": "stop"
    }
  ],
  "usage": {"prompt_tokens": 47, "completion_tokens": 17, "total_tokens": 64}
}
  • Structured output (JSON Schema):
curl -X POST http://127.0.0.1:8084/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "apple-foundation-model",
    "messages": [{"role": "user", "content": "What is the capital of France?"}],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "capital_response",
        "schema": {
          "type": "object",
          "properties": {
            "capital": {"type": "string"},
            "country": {"type": "string"}
          },
          "required": ["capital", "country"]
        },
        "strict": true
      }
    }
  }'
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "apple-foundation-model",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "{\"capital\": \"Paris\", \"country\": \"France\"}"},
      "finish_reason": "stop"
    }
  ]
}
  • Responses API:
curl -X POST http://127.0.0.1:8084/v1/responses \
  -H "Content-Type: application/json" \
  -d '{
    "model": "apple-foundation-model",
    "input": "Say hello in one word."
  }'
{
  "id": "resp_...",
  "object": "response",
  "status": "completed",
  "model": "apple-foundation-model",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [{"type": "output_text", "text": "Hi."}]
    }
  ]
}

Connecting via OpenAI SDK

You can connect using any OpenAI-compatible SDK by setting the base URL.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "http://127.0.0.1:8084/v1",
  apiKey: "your-api-key", // Required if --api-key is set; otherwise any value works
});

Development

  • Xcode 26.3 or later
  • Swift 6.2 or later
  • Bun

Setup

git clone https://github.com/p1atdev/Fameuse
cd Fameuse
swift build
bun i

Testing

Swift tests:

swift test

Client tests (requires a running server):

bun test

Lint / Format

Lint and format TypeScript code:

bun run lint
bun run format

Skills

License

Dual-licensed under MIT or Apache-2.0. See LICENSE-MIT and LICENSE-APACHE for details.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors