Skip to content

keizman/amp2api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amp2api (Go)

OpenAI-compatible relay for Amp with 2 modes: smart, rush.

Features

  • Go implementation, no UI
  • .env config for AMP_API_KEY
  • OpenAI-compatible endpoints:
    • GET /v1/models
    • POST /v1/chat/completions
  • Mode switching by mode or model
    • smart / amp-smart
    • rush / amp-rush

Quick Start

cd /opt/LLM/amp2api
cp .env.example .env
# edit .env and set AMP_API_KEY

go run .

Server default: http://127.0.0.1:18086

Request Example

curl http://127.0.0.1:18086/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "amp-smart",
    "messages": [
      {"role": "user", "content": "Write a Go hello world"}
    ]
  }'

Use explicit mode:

curl http://127.0.0.1:18086/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "rush",
    "messages": [
      {"role": "user", "content": "Summarize this code change in 3 bullets"}
    ]
  }'

Notes

  • stream: true is supported as pseudo-stream SSE (single chunk + [DONE]).
  • Amp upstream may return 402 if the key account has no paid credits for SDK/execute-style usage.
  • deep mode is currently disabled in this relay.
  • This project does not expose Amp internal tool details in API output.
  • Set DEBUG=true (or DEBUG=Ture) to print verbose logs: client request params, upstream request/response, and API response.

About

ampcode cli to api

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors