Skip to content

Step 34: ASP.NET server — OpenAI-compatible API endpoints #84

Closed

Description

@kkokosa

Summary

Add an OpenAI-compatible API server to dotLLM via ASP.NET Minimal API endpoints in DotLLM.Server.

Roadmap Step: 34
Dependencies: Step 16 (Chat templates ✅), Step 17 (Streaming ✅), Step 42 (Tool calling ✅)

Acceptance Criteria

  • /v1/chat/completions — non-streaming and SSE streaming, chat template formatting, tool calling
  • /v1/completions — raw prompt completion, non-streaming and streaming
  • /v1/models — list loaded model info
  • /v1/tokenize — encode text to tokens (extension endpoint)
  • /v1/detokenize — decode tokens to text (extension endpoint)
  • /health and /ready — health and readiness probes
  • Model loading at startup via --model CLI arg
  • CPU and GPU device support via --device arg
  • Sequential request processing via semaphore (batching is Step 35)
  • OpenAI Python SDK compatibility verified
  • response_format support (json_object, json_schema)
  • tools / tool_choice support with tool call detection
  • Request/response DTOs with snake_case JSON serialization

Key Files

New

  • src/DotLLM.Server/Models/ — OpenAI-compatible request/response DTOs
  • src/DotLLM.Server/Endpoints/ — Minimal API endpoint handlers
  • src/DotLLM.Server/RequestConverter.cs — DTO ↔ engine type conversion
  • src/DotLLM.Server/ServerState.cs — concurrency control, readiness
  • src/DotLLM.Server/ServerOptions.cs — startup configuration

Modified

  • src/DotLLM.Server/Program.cs — model loading, DI, endpoint registration
  • src/DotLLM.Server/DotLLM.Server.csproj — add project references

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions