gpt-4

This documentation is valid for the following list of our models:

  • gpt-4

Model Overview

The model represents a significant leap forward in conversational AI technology. It offers enhanced understanding and generation of natural language, capable of handling complex and nuanced dialogues with greater coherence and context sensitivity. This model is designed to mimic human-like conversation more closely than ever before.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

Submit a request

API Schema

Generate a conversational response using a language model.

post

Creates a chat completion using a language model, allowing interactive conversation by predicting the next response based on the given chat history. This is useful for AI-driven dialogue systems and virtual assistants.

Authorizations
Body
modelundefined · enumrequired
Options: gpt-4
frequency_penaltynumber | nullableoptional
logit_biasobject | nullableoptional

logprobsboolean | nullableoptional
top_logprobsnumber | nullableoptional
max_tokensnumber · min: 1 · default: 512optional
max_completion_tokensinteger · min: 1optional
ninteger | nullableoptional
predictionobjectoptional

presence_penaltynumber | nullableoptional
seedinteger · min: 1optional
messagesone of[]required

streamboolean · default: falseoptional
stream_optionsobjectoptional

top_pnumber · min: 0.1 · max: 1optional
temperaturenumber · max: 2optional
stopany ofoptional

toolsobject[]optional

tool_choiceany ofoptional

parallel_tool_callsbooleanoptional
reasoning_effortstring · enumoptional
Options: low, medium, high
response_formatone ofoptional

Responses
curl -L \
  --request POST \
  --url 'https://api.aimlapi.com/v1/chat/completions' \
  --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-4",
    "frequency_penalty": 1,
    "logit_bias": {
      "ANY_ADDITIONAL_PROPERTY": 1
    },
    "logprobs": true,
    "top_logprobs": 1,
    "max_tokens": 1,
    "max_completion_tokens": 1,
    "n": 1,
    "prediction": {
      "type": "content",
      "content": "text"
    },
    "presence_penalty": 1,
    "seed": 1,
    "messages": [
      {
        "role": "system",
        "content": "text",
        "name": "text"
      }
    ],
    "stream": true,
    "stream_options": {
      "include_usage": true
    },
    "top_p": 1,
    "temperature": 1,
    "stop": "text",
    "tools": [
      {
        "type": "function",
        "function": {
          "description": "text",
          "name": "text",
          "parameters": null,
          "required": [
            "text"
          ]
        }
      }
    ],
    "tool_choice": "none",
    "parallel_tool_calls": true,
    "reasoning_effort": "low",
    "response_format": {
      "type": "text"
    }
  }'

No body

Last updated

Was this helpful?