ai4save.com
Initializing system...
Resources: 1/21 8%
api docs
ai4save // api documentation & developer reference
multi-standard llm gateway
CHAT API

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.

1. OpenAI Completions
compatible with /v1/chat/completions
2. OpenAI Responses
new /v1/responses standard
3. Anthropic Messages
Claude /v1/messages standard
4. Google Gemini
Gemini :generateContent standard

authentication & 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

POST 1. OpenAI Chat Completions recommended
compatible with OpenAI SDK, NextChat, Cursor, Cline, Open WebUI...
direct api endpoint url:
https://ai4save.com/api/v1/chat/completions
• url alias: https://ai4save.com/api/chat/completions • for SDKs, set Base URL: https://ai4save.com/api/v1
POST 2. OpenAI Responses API
new responses standard (input & instructions)
direct api endpoint url:
https://ai4save.com/api/v1/responses
POST 3. Anthropic Messages (Claude)
compatible with Anthropic Claude SDK
direct api endpoint url:
https://ai4save.com/api/v1/messages
• for Anthropic SDK, set Base URL: https://ai4save.com/api (SDK appends /v1/messages)
POST 4. Google Gemini API
compatible with Google GenAI SDK (generateContent)
direct api endpoint url:
https://ai4save.com/api/v1/models/{model}:generateContent
streaming api endpoint url (SSE):
https://ai4save.com/api/v1/models/{model}:streamGenerateContent

SPECS

1. openai chat completions spec

the most popular standard, fully compatible with openai sdk (python, nodejs, curl, langchain, llamaindex).

POST /api/v1/chat/completions (alias: /api/chat/completions)

request body parameters (json)

model_id string required

unique model identifier code (e.g., gemini-3-5-flash or claude-3-7-sonnet). also accepts the alternative field model.

messages array required

list of conversation messages. each object contains role (system, user, assistant) and content (text string or multimodal array for image/pdf/audio).

stream boolean optional (default: false)

if true, returns server-sent events (sse) streaming tokens in real time (terminated with data: [DONE]).

temperature number optional (0.0 - 2.0)

sampling temperature controlling randomness and creativity.

max_tokens integer optional

maximum number of tokens to generate in the response.


SPECS

2. openai responses api spec

new openai responses api standard with input and instructions fields.

POST /api/v1/responses
request body (json)
{
  "model": "gemini-3-5-flash",
  "input": "analyze the pros and cons of llm proxy gateways",
  "instructions": "reply in english, markdown format",
  "stream": true
}

SPECS

3. anthropic messages spec

directly compatible with anthropic claude sdk (anthropic-version header, top-level system parameter, and user/assistant messages array).

POST /api/v1/messages
request body (json)
{
  "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
}

SPECS

4. google gemini generate content spec

compatible with google generative ai sdk structure (generateContent and streamGenerateContent endpoints).

POST /api/v1/models/{model}:generateContent
POST /api/v1/models/{model}:streamGenerateContent
request body (json)
{
  "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

console output idle
no requests sent yet. configure parameters on the left and click "send request".

7. active models

currently active models on the system. click on model code to copy into request payload.

0 models
per page:
model context window pricing (1m tokens) input modalities
SpaceXAI: Grok 4.6
x-ai
x-ai/grok-4.6
4,096 tokens in: $2.00
out: $6.00
text
ChatGPT-6 Astra
openai
openai/gpt-6-astra
4,096 tokens in: $10.00
out: $50.00
text
Qwen3.8 Max
qwen
qwen/qwen3.8-max
4,096 tokens in: $2.00
out: $6.00
text
Gemini 3.8 Flash
google
gemini-3.8-flash
4,096 tokens in: $0.75
out: $3.75
text
Claude Fable 5.1
anthropic
anthropic/claude-fable-5.1
4,096 tokens in: $10.00
out: $50.00
text
ChatGPT 5.6 Luna
openai
gpt-5.6-luna
1,050,000 tokens in: $0.20
out: $1.20
text image pdf file
Claude Sonnet 5
anthropic
claude-sonnet-5
1,000,000 tokens in: $2.00
out: $10.00
text image pdf file
ChatGPT-oss-20b
openai
openai/gpt-oss-20b
4,096 tokens in: $0.03
out: $0.13
text
Meta Llama 3.1 8B Instruct Turbo
deepinfra
deepinfra/meta-llama/meta-llama-3.1-8b-instruct-turbo
131,072 tokens in: $0.05
out: $0.08
text
Qwen3.7 Flash
qwen
qwen/qwen3.7-flash
0 tokens in: $0.03
out: $0.14
text
showing 1 - 10 of 24 models