Skip to content

Latest commit

 

History

History
117 lines (84 loc) · 2.64 KB

File metadata and controls

117 lines (84 loc) · 2.64 KB

Swagger/OpenAPI Documentation

Accessing the Documentation

Once the server is running, visit:

http://localhost:3000/api-docs

Or simply navigate to the root URL and you'll be automatically redirected:

http://localhost:3000/

Features

📖 Complete API Reference

  • Full OpenAPI 3.0 specification
  • Detailed descriptions of all endpoints
  • Request/response schemas
  • Parameter definitions

🧪 Interactive Testing

  • Try it out functionality for every endpoint
  • Test API calls directly from your browser
  • See real responses without writing code
  • Test authentication

📋 Examples

  • Pre-configured request examples
  • Multiple scenarios for each endpoint
  • Copy-paste ready code snippets

🔐 Authentication

  • Configure Bearer token authentication
  • Test authorized and unauthorized requests
  • See authentication errors in real-time

How to Use

1. Browse the API

  • Click on any endpoint to expand it
  • View request parameters and body schemas
  • See response examples

2. Test Endpoints

  1. Click "Try it out" on any endpoint
  2. Fill in the required parameters
  3. If API_KEY is set, click "Authorize" and enter your Bearer token
  4. Click "Execute"
  5. View the response

3. Copy Code Examples

  • Swagger UI shows curl commands
  • Copy and use in your terminal
  • Adapt for your programming language

Example Requests

Chat Completion

{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 100
}

List Models

Simply click "Execute" on the GET /v1/models endpoint - no parameters needed!

Streaming

Set "stream": true in your chat completion request to test Server-Sent Events.

Available Sections

The Swagger UI is organized into these sections:

  • Health - Health check endpoints
  • Models - Model management
  • Chat - Chat completion operations
  • Completions - Legacy completion operations
  • Embeddings - Embedding operations (not supported)

Tips

  • Collapse/Expand All: Use the buttons at the top
  • Filter by Tag: Click on section names to filter
  • Dark Mode: Built into Swagger UI
  • Mobile Friendly: Works on all devices

Customization

The Swagger UI is configured to:

  • Hide the top bar for cleaner appearance
  • Use custom site title
  • Include all available models
  • Show request/response examples

OpenAPI Specification

The raw OpenAPI specification is available in src/swagger.ts and can be exported for:

  • API documentation generation
  • Client SDK generation
  • API gateway configuration
  • Testing tools integration

Enjoy exploring the API! 🚀