Skip to content

feat: OpenAI-compatible API endpoint — serve gateway as an API for external tools #465

Description

@rexlunae

Inspiration: Unsloth

Unsloth exposes loaded models via both Anthropic-compatible (/v1/messages) and OpenAI-compatible (/v1/chat/completions, /v1/responses) API endpoints. This lets Cursor, Continue, Cline, Open WebUI, and any OpenAI-compatible tool use your local models. It also supports API key management with sk-unsloth-... keys.

What RustyClaw could do

Expose the RustyClaw gateway as an OpenAI-compatible API endpoint:

  1. POST /v1/chat/completions — OpenAI chat completions endpoint
  2. GET /v1/models — List available models/providers
  3. API key management — Generate/revoke sk-rustyclaw-... keys with scoped access (which models, tools allowed, rate limits)
  4. Streaming support — SSE streaming responses
  5. Tool calling passthrough — Map OpenAI tool call format to/from RustyClaw's internal representation

Why this matters

RustyClaw already connects to providers. This makes RustyClaw be a provider — so any OpenAI-compatible tool (VS Code extensions, chat UIs, other agents) can use RustyClaw as their LLM backend, with all of RustyClaw's security, credential management, and tool ecosystem available.

Scope

  • rustyclaw-core: /v1/chat/completions + /v1/models HTTP handlers in the gateway
  • rustyclaw-core: API key management (CRUD, scoping, revocation)
  • Feature flag: openai-api (off by default, since it exposes the gateway to external requests)
  • Security: keys are scoped, the endpoint is opt-in, default bound to localhost

Prior art

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions