Skip to main content
POST
https://models.ageneral.ai
/
v1
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://models.ageneral.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "openai/gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "Say hello in one sentence."
    }
  ]
}
'
{}

Authorizations

Authorization
string
header
required

Ageneral virtual key as sk-bf-… or node service JWT. Send as Authorization: Bearer <token>.

Body

application/json

Aligned with OpenAI Chat Completions. Optional fields such as tools, stream, and response_format follow the same JSON shape as OpenAI.

model
string
required

Model id in provider/model form.

Example:

"openai/gpt-4o-mini"

messages
object[]
required

Conversation messages.

stream
boolean

If true, the response uses SSE as text/event-stream.

temperature
number
max_tokens
integer
max_completion_tokens
integer
tools
object[]
tool_choice

Response

Success. JSON object, or text/event-stream when stream is true.

OpenAI-compatible chat completion object.