APIMODELSAPIMODELS
Документация API

apimodels.app

Docs/Completions API
OpenAI

Completions API

GPT-5.4 Pro

[Deprecated] Legacy text completions endpoint. GPT-5.4 Pro has been retired; GPT-5.4 / GPT-5.5 are now served via the Responses API — see /docs/codex.

Overview

This /v1/completions endpoint is a legacy prompt-based completions API with no currently active model (GPT-5.4 Pro has been retired). For the new GPT-5.4 / GPT-5.5, use the Responses API (/v1/responses) — see /docs/codex. For ordinary chat models, use /v1/messages or /v1/chat/completions (see /docs/llm).

Endpoint

POST/api/v1/completions

Available Models

Prices are per 1M tokens

ModelInputOutputDescription

Request Parameters

modelrequiredstring
Model to use (legacy endpoint — no active model currently)
promptrequiredstring | string[]
The prompt(s) to complete. String or array of strings.
max_tokensinteger
Maximum tokens to generate. Default: 4096
streamboolean
Enable streaming responses. Default: false
temperaturenumber
Sampling temperature (0-2). Default: 1
top_pnumber
Nucleus sampling probability. Default: 1
ninteger
Number of completions to generate. Default: 1
stopstring | string[]
Stop sequences
presence_penaltynumber
Presence penalty (-2 to 2). Default: 0
frequency_penaltynumber
Frequency penalty (-2 to 2). Default: 0
suffixstring
Suffix appended after the completion
echoboolean
Echo prompt in addition to completion. Default: false

Basic Request

curl -X POST https://api.apimodels.app/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-pro",
    "prompt": "Write a detailed analysis of quantum computing:",
    "max_tokens": 1024
  }'

Response

{
  "id": "cmpl-abc123",
  "object": "text_completion",
  "created": 1700000000,
  "model": "gpt-5.4-pro",
  "choices": [
    {
      "text": "Quantum computing leverages the principles of quantum mechanics...",
      "index": 0,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 256,
    "total_tokens": 268
  }
}

Streaming

Set stream: true to receive Server-Sent Events (SSE).

curl -X POST https://api.apimodels.app/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-pro",
    "prompt": "Explain the theory of relativity:",
    "max_tokens": 1024,
    "stream": true
  }'

Billing

Credits are calculated based on actual token usage:

Cost = (prompt_tokens * input_price + completion_tokens * output_price) / 1,000,000
Credits = Cost  // amounts are in USD ($)

Error Codes

400Invalid request parameters
401Invalid or missing API key
402Insufficient credits
404Model not found
429Rate limit exceeded
500Internal server error

FAQ

Is it OpenAI SDK compatible?

Yes. Point the OpenAI SDK (or Cursor / Codex / Cherry Studio) at our /v1 base URL and use your APIMODELS key. Same request/response shape as OpenAI chat completions.

Which models are on the completions endpoint?

OpenAI-format models — GPT, Grok, GLM, Qwen, DeepSeek, MiniMax — via one key. Claude and Gemini are best called via /v1/messages.