OpenAI API Documentation

Supported Endpoints

1. Completions (/completions)

Description:
Generates text completions based on the provided prompt.

Request Parameters

  • model (string): Model identifier.

  • prompt (string | list<string> | list<int> | list<list<int>>): Prompt text(s) or token IDs.

  • max_tokens (int, optional): Maximum tokens to generate.

  • temperature (float, optional, range: 0–2): Sampling randomness.

  • frequency_penalty (float, optional, range -2 - 2): Penalize new tokens based on their existing frequency in the text so far

  • presence_penalty (float, optional, range -2 - 2): Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood of talking about new topics.

  • logits_bias (map<token_id, score>, optional): Modify the likelihood of specified tokens appearing in the completion.

  • logprobs (int, optional): Include the log probabilities on the logprobs most likely output tokens, as well the chosen tokens.

  • top_p (float, optional, range: 0–1): Nucleus sampling parameter.

  • stop (string | list, optional): Tokens that terminate completion.

  • suffix (string, optional): Text appended after the generated completion.

  • stream (bool, optional): Whether to stream back partial progress.

  • stream_options (obj, optional): Options for streaming response. Only set this when you set stream: true.

    • include_usage (bool, optional): If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array.

  • Additional vLLM parameters: top_k, min_p, ignore_eos, min_tokens, skip_special_tokens, stop_token_ids. These parameters are an extension to OpenAI API parameters. For information on these parameters: https://docs.vllm.ai/en/v0.6.5/dev/sampling_params.html

Not Supported

  • echo, best_of, n > 1, user

Response

  • id: Unique completion ID.

  • model: Model used.

  • choices: Completion results containing text, index, finish_reason, and optionally logprobs.

  • usage: Token information (prompt_tokens, completion_tokens, total_tokens).


2. Chat Completions (/chat/completions)

Description:
Creates a model response for the given chat conversation.

Request Parameters

  • model (string): Model identifier.

  • messages (list): Conversation history; each message has a role (system/user/assistant) and content.

  • max_tokens (int, optional): Maximum tokens to generate.

  • temperature (float, optional, range: 0–2): Sampling randomness.

  • frequency_penalty (float, optional, range -2 - 2): Penalize new tokens based on their existing frequency in the text so far

  • presence_penalty (float, optional, range -2 - 2): Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood of talking about new topics.

  • logits_bias (map<token_id, score>, optional): Modify the likelihood of specified tokens appearing in the completion.

  • logprobs (bool, optional): Whether to return log probabilities of the output tokens or not.

  • top_logprobs (int, optional): An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

  • top_p (float, optional, range: 0–1): Nucleus sampling parameter.

  • stop (string | list, optional): Tokens that terminate completion.

  • stream (bool, optional): Whether to stream back partial progress.

  • stream_options (obj, optional): Options for streaming response. Only set this when you set stream: true.

    • include_usage (bool, optional): If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array.

  • Additional vLLM parameters: top_k, min_p, ignore_eos, min_tokens, skip_special_tokens, stop_token_ids. These parameters are an extension to OpenAI API parameters. For information on these parameters: https://docs.vllm.ai/en/v0.6.5/dev/sampling_params.html

Not Supported

  • Tool calling or function calling

  • Structured outputs (response_format)

  • LoRA

  • Multi-modal input

  • Other parameters:

    • store, service_tier, seed, prediction, metadata, max_completion_tokens - please use max_tokens.

    • n > 1

    • reasoning_effort, user and web_search_options.

Response

  • id: Unique chat completion ID.

  • model: Model used.

  • choices: Chat completion results containing message, finish_reason, and optionally logprobs.

  • usage: Token usage information.


3. Embeddings (/embeddings)

Description:
Creates an embedding vector(s) representing the input text.

Request Parameters

  • input (string | list<string> | list<int> | list<list<int>>): Text(s) or token IDs.

  • model (string, optional): Embedding model identifier.

  • encoding_format (string, optional): float or base64.

Not Supported

  • dimensions and user

Response

  • data: Embedding results with fields index, object, and embedding.

  • usage: Token information.


4. Moderations (/moderations)

Description:
Evaluates text input for potentially harmful content.

Supported Models:

  • Llama Guard 3 Model Family.

Request Parameters

  • input (string | list<string>): Text(s) to moderate.

Not Supported

  • Multi-modal input

Response

  • results: Moderation results containing flagged status and categories indicating specific moderation issues.


Common Error Structure

In case of any error, the following response message will be sent:

  • object: error

  • message: Description of the error.

  • type: Error category.


Notes

  • Parameter validations are enforced (e.g., temperature range: 0–2, top_p range: 0–1).

  • For more information: https://platform.openai.com/docs/api-reference

Ensure adherence to documented constraints when integrating with this API.