LLM API GATEWAY
SWAGGER SPECS

Complete OpenAPI 3.0 specifications for LLM API gateways. Interactive documentation, schema definitions, and integration examples for seamless API integration.

Explore Specs
openapi: "3.0.0" info: title: "LLM API Gateway" version: "2.1.0" paths: /v1/completions: post: summary: "Create completion" tags: - Completions
📋

OpenAPI 3.0

Industry-standard specification format compatible with Swagger UI, Postman, and all major API tools.

🔌

Multi-Provider

Unified API interface supporting OpenAI, Anthropic, Google AI, and other LLM providers.

âš¡

Ready to Use

Import directly into your development workflow with code generation and client SDKs.

API Specifications Overview

The LLM API Gateway OpenAPI specification defines a unified interface for interacting with multiple large language model providers. This specification abstracts provider-specific differences, allowing developers to integrate once and support multiple backends seamlessly.

Base URL

https://api.llm-gateway.io/v1

Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Content Type

All request and response bodies use JSON format:

Content-Type: application/json

Available Endpoints

The gateway exposes the following endpoints for LLM interactions:

Method Endpoint Description
GET /models List available models and their capabilities
POST /completions Create text completion from prompt
POST /chat/completions Create chat completion with conversation
POST /embeddings Generate vector embeddings for text
POST /fine-tunes Create fine-tuning job for custom models
GET /fine-tunes/{id} Get fine-tuning job status and details
DELETE /models/{id} Delete fine-tuned model

Schema Definitions

The OpenAPI specification defines comprehensive schemas for all request and response objects:

Completion Request

{
  "model": "string (required)",
  "prompt": "string | array",
  "max_tokens": "integer",
  "temperature": "number (0-2)",
  "top_p": "number (0-1)",
  "n": "integer (default: 1)",
  "stream": "boolean",
  "stop": "string | array"
}

Chat Request

{
  "model": "string (required)",
  "messages": [{
    "role": "system|user|assistant",
    "content": "string"
  }],
  "temperature": "number",
  "max_tokens": "integer",
  "presence_penalty": "number",
  "frequency_penalty": "number"
}

Response Schema

{
  "id": "string",
  "object": "text_completion | chat.completion",
  "created": "integer (timestamp)",
  "model": "string",
  "provider": "string",
  "choices": [{
    "index": "integer",
    "text": "string (for completions)",
    "message": {
      "role": "string",
      "content": "string"
    } (for chat)",
    "finish_reason": "stop | length | content_filter"
  }],
  "usage": {
    "prompt_tokens": "integer",
    "completion_tokens": "integer",
    "total_tokens": "integer"
  }
}

Integration Examples

Import the OpenAPI specification into your preferred tools:

Swagger UI

# Download the spec
curl https://api.llm-gateway.io/openapi.yaml -o openapi.yaml

# Run Swagger UI locally
docker run -p 8080:8080 \
  -e SWAGGER_JSON=/spec/openapi.yaml \
  -v $(pwd)/openapi.yaml:/spec/openapi.yaml \
  swaggerapi/swagger-ui

Postman Import

# Import directly via URL
https://api.llm-gateway.io/openapi.json

# Or download and import the file
File -> Import -> Upload Files -> openapi.json

Generate Client SDK

# Using OpenAPI Generator
npx @openapitools/openapi-generator-cli generate \
  -i https://api.llm-gateway.io/openapi.yaml \
  -g python \
  -o ./client-sdk

# Available generators: python, java, typescript, go, ruby, etc.

Curl Example

curl -X POST https://api.llm-gateway.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [
      {"role": "user", "content": "Hello, how are you?"}
    ]
  }'

Provider Support Matrix

The gateway normalizes responses across different LLM providers:

Provider Models Features
OpenAI GPT-4, GPT-3.5, DALL-E, Whisper Completions, Chat, Embeddings, Fine-tuning
Anthropic Claude 3 Opus, Sonnet, Haiku Chat, Vision, Long Context
Google AI Gemini Pro, Gemini Ultra Chat, Vision, Multimodal
Cohere Command, Embed, Generate Chat, Embeddings, Reranking

Partner Resources