OpenAI-Compatible Interface
For features not covered here, refer to the OpenAI API Reference.Message Roles
| Role | Purpose | Example |
|---|---|---|
| system | Sets the model’s behavior and persona | ”You are an experienced software engineer.” |
| user | The end user’s input | ”How do I reverse a string in Python?“ |
| assistant | Prior model responses, for multi-turn context | ”You can use s[::-1] or ”.join(reversed(s)).” |
Basic Conversation
Streaming
Tool Calling (Function Calling)
For more details, see the OpenAI tool use guide.Response API
The OpenAI Responses API is supported for OpenAI models. See the OpenAI Responses API docs for usage details.- Set
OPENAI_BASE_URLtohttps://api.elkapi.com/v1 - Set
OPENAI_API_KEYto your API key - Some parameters (
presence_penalty,frequency_penalty,logit_bias, etc.) may be ignored by certain models - The legacy
function_callparameter is deprecated — usetoolsinstead
Anthropic-Compatible Interface
For features not covered here, refer to the Anthropic API Reference.Basic Conversation
Streaming
Tool Calling
For more details, see the Anthropic tool use guide.- Set
ANTHROPIC_BASE_URLtohttps://api.elkapi.com/anthropic - Set
ANTHROPIC_API_KEYto your API key
Gemini AI Studio Compatible Interface
Gemini models support direct calls using the official Google AI Studio API format — no conversion to OpenAI format required. Ideal for projects already using the Google genai SDK. For features not covered here, refer to the Google AI Studio API Reference.Basic Conversation
Streaming
Tool Calling (Function Calling)
For more details, see the Google AI Studio function calling guide.- Set
base_url/baseUrltohttps://api.elkapi.com(without/v1betasuffix — the SDK appends it automatically) - Set
api_version/apiVersiontov1beta - Set
api_key/apiKeyto your API key - Install dependencies: Python
pip install google-genai, Node.jsnpm install @google/genai
Related Links
OpenAI Official Docs
OpenAI Chat Completions API reference
Anthropic Official Docs
Anthropic Messages API reference
Google AI Studio Docs
Gemini GenerateContent API reference