chat api & ai gateway documentation
the high-performance proxy gateway of ai4save enables seamless integration of world-class AI models (gpt-4o, claude-3-7-sonnet, gemini-2.5-pro, qwen-2.5, deepseek...) through a single unified endpoint with optimized token costs.
/v1/chat/completions/v1/responses standard/v1/messages standard:generateContent standardauthentication & api endpoint urls
all gateway requests use https protocol with api key authentication via authorization header. below is the complete list of dedicated api endpoints for each supported standard.
authentication headers
Authorization: Bearer YOUR_API_KEY X-API-Key: YOUR_API_KEY (optional alternative) Content-Type: application/json
dedicated api endpoint urls
https://ai4save.com/api/v1/chat/completions
https://ai4save.com/api/chat/completions
• for SDKs, set Base URL: https://ai4save.com/api/v1
https://ai4save.com/api/v1/responses
https://ai4save.com/api/v1/messages
https://ai4save.com/api (SDK appends /v1/messages)
https://ai4save.com/api/v1/models/{model}:generateContent
https://ai4save.com/api/v1/models/{model}:streamGenerateContent
1. openai chat completions spec
the most popular standard, fully compatible with openai sdk (python, nodejs, curl, langchain, llamaindex).
/api/v1/chat/completions
(alias: /api/chat/completions)
request body parameters (json)
unique model identifier code (e.g., gemini-3-5-flash or claude-3-7-sonnet). also accepts the alternative field model.
list of conversation messages. each object contains role (system, user, assistant) and content (text string or multimodal array for image/pdf/audio).
if true, returns server-sent events (sse) streaming tokens in real time (terminated with data: [DONE]).
sampling temperature controlling randomness and creativity.
maximum number of tokens to generate in the response.
2. openai responses api spec
new openai responses api standard with input and instructions fields.
/api/v1/responses
{
"model": "gemini-3-5-flash",
"input": "analyze the pros and cons of llm proxy gateways",
"instructions": "reply in english, markdown format",
"stream": true
}
3. anthropic messages spec
directly compatible with anthropic claude sdk (anthropic-version header, top-level system parameter, and user/assistant messages array).
/api/v1/messages
{
"model": "claude-3-7-sonnet",
"system": "you are an expert in php and javascript.",
"messages": [
{ "role": "user", "content": "write a function to reverse a string in php" }
],
"max_tokens": 1024,
"stream": true
}
4. google gemini generate content spec
compatible with google generative ai sdk structure (generateContent and streamGenerateContent endpoints).
/api/v1/models/{model}:generateContent
/api/v1/models/{model}:streamGenerateContent
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "explain the attention mechanism in transformer models briefly" }
]
}
],
"generationConfig": {
"temperature": 0.7,
"maxOutputTokens": 2048
}
}
5. code samples (sdk & integrations)
select your programming language to view quick integration code.
6. interactive sandbox (live tester)
test the api directly with your api key. configure request body and inspect real-time streaming responses.
request configuration
7. active models
currently active models on the system. click on model code to copy into request payload.