Docs

ChatCompletions Format

Create a model response from conversation history. Supports streaming and non-streaming. Compatible with OpenAI Chat Completions API.

FieldValue
Base URLhttps://token.easyapi.com/v1
AuthenticationAuthorization: Bearer `API_KEY`
Example modelgpt-4
FormatOpenAI Chat Completions compatible
BillingPay as you go
Note: Full path: POST /v1/chat/completions. OpenAI SDK base_url must include /v1.

Example model

Examples below use gpt-4 (GPT-4). Replace model and adjust size, quality, etc. per console docs when switching models.

Create chat completion

POSThttps://token.easyapi.com/v1/chat/completions

Create a model response from conversation history. Compatible with OpenAI Chat Completions API; supports streaming and non-streaming.

Request parameters

NameInTypeRequiredDescription
AuthorizationheaderstringYesEasyAPI API Key. Format: Bearer `API_KEY`
Content-TypeheaderstringYesRequest body format, always application/json

Request body

NameTypeRequiredDescription
modelstringYesModel ID
messagesarray<object>YesConversation message list
temperaturenumberNoSampling temperature, default 1, range 0–2
top_pnumberNoNucleus sampling, default 1, range 0–1
nintegerNoNumber of completions, default 1, must be ≥ 1
streambooleanNoStream responses, default false
stream_optionsobjectNoExtra options for streaming
stopstring | array<string>NoStop sequence(s), string or string array
max_tokensintegerNoMax tokens to generate
max_completion_tokensintegerNoMax completion tokens
presence_penaltynumberNoPresence penalty, default 0, range -2–2
frequency_penaltynumberNoFrequency penalty, default 0, range -2–2
logit_biasobjectNoBias specific token probabilities
userstringNoEnd-user identifier for abuse monitoring
toolsarray<object>NoTool definitions the model may call
tool_choicestring | objectNoTool choice strategy, string or object
response_formatobjectNoResponse format, e.g. JSON Schema
seedintegerNoSeed for best-effort reproducibility
reasoning_effortstringNomedium
modalitiesarray<string>NoOutput modalities, e.g. text, audio
audioobjectNoAudio output configuration

Example

{
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "temperature": 0.7,
  "stream": false
}

Response example

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1718452800,
  "model": "gpt-4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 12,
    "total_tokens": 32,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 20,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 12,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  },
  "system_fingerprint": "fp_abc123"
}