Skip to content
Bu sayfa henüz dilinizde sunulmuyor; bu nedenle İngilizce görüntüleniyor.

General Chat API (Default Non-Streaming)

Unified chat API interface supporting all text generation models

Tüm belgeler
POST/api/v1/chat/completions
  • Select different AI models via the model parameter
  • Compatible with OpenAI Chat Completions API format
  • Non-streaming output, returns complete response at once

İstek örnekleri

curl --request POST \
  --url https://api.apisea.ai/api/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-5", # Can be replaced with any supported model ID
    "stream": false,
    "messages": [
      {
        "role": "system",
        "content": "You are a professional AI assistant."
      },
      {
        "role": "user",
        "content": "Tell me about the history of artificial intelligence."
      }
    ]
  }'

Authorizations

Authorizationstringrequired

All API endpoints require Bearer Token authentication

Get your API Key:

Visit the API Key Management Page to get your API Key

Add it to the request header:

text
Authorization: Bearer YOUR_API_KEY

Body

modelstringrequireddefault: gpt-5

Model name

Any chat model listed on the Models page — call GET /v1/models for the live list.

messagesarrayrequired

List of conversation messages

Message array. Each message contains role and content fields.

💡 Quick fill (Try it area):

  1. Click "+ Add an item" to add a message
  2. Enter user (user message), assistant (AI response), or system (system prompt) for role
  3. Enter what you want to say in content

Message object structure

rolestringrequireddefault: user

Role type

  • user - User message
  • assistant - AI response (for multi-turn)
  • system - System prompt
contentstringrequired

Message content

Your question or message

Example:

json
[{"role": "user", "content": "Hello, please introduce yourself"}]

Advanced usage:

Add system prompt (to define AI behavior):

json
[
  {"role": "system", "content": "You are a professional Python tutor"},
  {"role": "user", "content": "How do I learn programming?"}
]

Multi-turn conversation (with context):

json
[
  {"role": "user", "content": "Hello"},
  {"role": "assistant", "content": "Hi! How can I help you?"},
  {"role": "user", "content": "Tell me about AI"}
]

Role descriptions:

  • user: User message (use this most of the time)
  • system: System prompt to set AI behavior and role
  • assistant: AI's previous responses, used for conversation context
temperaturenumber

Controls output randomness, range 0-2

  • Lower values (e.g., 0.2) make output more deterministic
  • Higher values (e.g., 1.8) make output more random

Default: 1.0

max_tokensinteger

Maximum number of tokens to generate

Different models have different maximum limits, please refer to specific model documentation

streambooleandefault: false

Whether to use streaming output

  • false: Complete response at once
  • true: Streaming return

Default: false

top_pnumber

Nucleus sampling parameter, range 0-1

Controls diversity of generated text, recommend using either this or temperature

Default: 1.0

frequency_penaltynumber

Frequency penalty, range -2.0 to 2.0

Positive values reduce the likelihood of repeating the same words

Default: 0

presence_penaltynumber

Presence penalty, range -2.0 to 2.0

Positive values increase the likelihood of talking about new topics

Default: 0

stopstring or array

Stop sequences

Up to 4 sequences where generation will stop when encountered

ninteger

Number of completions to generate

Default: 1

⚠️ Note: Must enter a plain number (e.g., 1), do not use quotes or it will cause an error

Response

idstring

Unique identifier for the response

objectstring

Object type, fixed as chat.completion

createdinteger

Creation timestamp

modelstring

The actual model name used

choicesarray

List of generated responses

Properties

indexinteger

Choice index

messageobject

Message content

Properties

rolestring

Role type (assistant)

contentstring

Generated text content

finish_reasonstring

Reason for completion

Possible values:

  • stop - Natural completion
  • length - Maximum length reached
  • content_filter - Content filtered
  • function_call - Function call
usageobject

Token usage statistics

Properties

prompt_tokensinteger

Number of tokens in the input messages

completion_tokensinteger

Number of tokens in the generated content

total_tokensinteger

Total number of tokens

Supported Models

OpenAI Series

  • gpt-5 - GPT-5 base model
  • gpt-5.1 - GPT-5.1 enhanced version
  • gpt-5-chat-latest - GPT-5 latest chat version
  • gpt-5-mini - GPT-5 lightweight version, cost-effective

Anthropic Series

  • claude-opus-4-8 - Claude Opus 4.8 flagship model
  • claude-opus-4-7 - Claude Opus 4.7 flagship model
  • claude-opus-4-6 - Claude Opus 4.6 flagship model
  • claude-sonnet-4-6 - Claude Sonnet 4.6 balanced version
  • claude-opus-4-5-20251101 - Claude Opus 4.5 model

Google Series

  • gemini-3.5-flash - Gemini 3.5 fast version
  • gemini-3.1-pro-preview - Gemini 3.1 Pro preview version
  • gemini-3-pro-preview - Gemini 3 Pro preview version
  • gemini-3-pro-preview-thinking - Gemini 3 Pro deep thinking preview version
  • gemini-3-flash-preview - Gemini 3 Flash preview version
  • gemini-2.5-pro - Gemini 2.5 professional version
  • gemini-2.5-flash - Gemini 2.5 fast version
  • gemini-2.5-flash-lite - Gemini 2.5 ultra-lightweight version

DeepSeek Series

  • deepseek-v4-pro - DeepSeek V4 professional version
  • deepseek-v4-flash - DeepSeek V4 fast version
  • deepseek-v3.2 - DeepSeek V3.2 standard version
  • deepseek-v3.2-exp - DeepSeek V3.2 experimental version
  • deepseek-r1-250528 - DeepSeek R1 reasoning model
  • deepseek-v3-0324 - DeepSeek V3 standard version

Usage Examples

Basic Conversation

json
{
  "model": "gpt-5",
  "stream": false,
  "messages": [
    {"role": "user", "content": "Hello"}
  ]
}

System Prompt

json
{
  "model": "claude-sonnet-4-6",
  "stream": false,
  "messages": [
    {"role": "system", "content": "You are a professional Python programming tutor"},
    {"role": "user", "content": "How to use list comprehensions?"}
  ]
}

Multi-turn Conversation

json
{
  "model": "gemini-2.5-flash",
  "stream": false,
  "messages": [
    {"role": "user", "content": "What is machine learning?"},
    {"role": "assistant", "content": "Machine learning is a branch of artificial intelligence..."},
    {"role": "user", "content": "Can you give me an example?"}
  ]
}

Yanıtlar

{
  "code": 200,
  "data": {
    "id": "chatcmpl-9876543210",
    "object": "chat.completion",
    "created": 1677652288,
    "model": "gpt-5",
    "choices": [
      {
        "index": 0,
        "message": {
          "role": "assistant",
          "content": "The history of artificial intelligence (AI) dates back to the 1950s...\n\n1. **Early Period (1950s-1960s)**: The proposal of the Turing Test marked the beginning of AI research...\n\n2. **Expert Systems Era (1970s-1980s)**: Rule-based systems began to be applied in medical diagnosis, financial analysis, and other fields...\n\n3. **Rise of Machine Learning (1990s-2000s)**: Statistical learning methods gradually became mainstream...\n\n4. **Deep Learning Revolution (2010s-Present)**: Breakthroughs in neural network technology brought explosive growth to AI..."
        },
        "finish_reason": "stop"
      }
    ],
    "usage": {
      "prompt_tokens": 28,
      "completion_tokens": 320,
      "total_tokens": 348
    }
  }
}

Bu belgelerde bir sorun mu buldunuz? support@apisea.ai adresine e-posta gönderin.