Skip to main content

OpenAI-Compatible Chat Completions

Build conversational AI applications using Eden AI’s OpenAI-compatible chat completions endpoint.

Overview

Eden AI V3 provides full OpenAI API compatibility with multi-provider support. The endpoint follows OpenAI’s exact format, making it a drop-in replacement. Endpoint:
POST /v3/llm/chat/completions
Important: V3 uses mandatory streaming via Server-Sent Events (SSE). All responses are streamed.

Model Format

Use the simplified model string format for LLM:
provider/model
Examples:
  • openai/gpt-4
  • anthropic/claude-3-5-sonnet-20241022
  • google/gemini-pro
  • cohere/command-r-plus

Basic Chat Completion

Multi-Turn Conversations

Build conversations with message history:

System Messages

Guide the model’s behavior with system messages:

Temperature and Parameters

Control response creativity and behavior:

Available Parameters

ParameterTypeDefaultDescription
modelstringRequiredModel string (e.g., openai/gpt-4)
messagesarrayRequiredConversation messages
streambooleantrueEnable streaming (mandatory in V3)
temperaturefloat1.0Randomness (0-2)
max_tokensinteger-Maximum response tokens
top_pfloat1.0Nucleus sampling threshold
frequency_penaltyfloat0.0Penalize repeated tokens (-2 to 2)
presence_penaltyfloat0.0Penalize topic repetition (-2 to 2)

Response Format (Streaming)

Server-Sent Events format:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Available Models

OpenAI

  • openai/gpt-4
  • openai/gpt-4-turbo
  • openai/gpt-3.5-turbo

Anthropic

  • anthropic/claude-3-5-sonnet-20241022
  • anthropic/claude-3-opus-20240229
  • anthropic/claude-3-sonnet-20240229

Google

  • google/gemini-pro
  • google/gemini-1.5-pro

Cohere

  • cohere/command-r-plus
  • cohere/command-r

Meta

  • meta/llama-3-70b
  • meta/llama-3-8b

OpenAI Python SDK Integration

Use Eden AI with the OpenAI SDK:

Next Steps