Create a chat completion

Compatible with the OpenAI Chat Completions protocol, with optional built-in octen_broad_search and octen_search tools.

post/v1/chat/completions

Request

  • Base URL: https://api.octen.ai
  • URL: https://api.octen.ai/v1/chat/completions
  • Auth: one of:
    • HTTP bearer
    • API key in header x-api-key

Request body

model'openai/gpt-6.1-sol' | 'openai/gpt-6-astra' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.4' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-fable-5' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-sonnet-5.5' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-haiku-5.5' | 'anthropic/claude-haiku-4.5' | 'google/gemini-4-argon' | 'google/gemini-3.8-flash' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3-flash-preview' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.5' | 'minimax/minimax-m2.5' | 'qwen/qwen3.6-plus' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-flash-0731' required

The model to use for chat completion.

parallel_tool_callsboolean

Whether the model may issue multiple tool calls in one reply. When false, at most one tool call per turn.

streamboolean

Whether to enable streaming output. When true, returns chat.completion.chunk objects incrementally.

max_tokensinteger

Maximum number of tokens the model can output. If not set, the model's internal default limit is used.

max_completion_tokensinteger

Maximum completion tokens, including reasoning and visible output tokens. If not set, the model's internal default limit is used.

temperaturenumber

Controls randomness in generation. Higher values produce more diverse output; lower values produce more deterministic output.

top_pnumber

Nucleus sampling. Only tokens with cumulative probability up to top_p are considered.

top_kinteger

Sample only from the top K most probable tokens. 0 disables it.

min_pnumber

Minimum probability threshold relative to the most probable token. Tokens below it are filtered out. 0 disables it.

top_anumber

Dynamic filtering threshold based on the most probable token. 0 disables it.

repetition_penaltynumber

Penalizes tokens already present in the input. Above 1 suppresses repetition; below 1 encourages it.

frequency_penaltynumber

Penalizes tokens by their frequency in the output so far. Positive values reduce repetition.

presence_penaltynumber

Penalizes tokens that have already appeared. Positive values encourage new topics.

stopstring[]

Stop sequences. Generation stops when any of these strings is encountered.

seedinteger

Seed for reproducibility. With the same parameters and model version, output should be as consistent as possible.

reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'

Top-level alias for reasoning.effort. If both are set, reasoning takes precedence.

verbosity'low' | 'medium' | 'high'

Controls how verbose the reply is.

logit_biasobject

A JSON object mapping token IDs to bias values (-100 to 100), added to the logits before sampling.

logprobsboolean

Whether to return the log probabilities of the output tokens.

top_logprobsinteger

Number of most likely tokens to return at each position. Requires logprobs to be true.

userstring

A unique identifier for the end user. Use hashed or pseudonymous identifiers to avoid passing personally identifiable information.

modalitiesstring[]

Requested output modalities.

prompt_cache_keystring

Cache key for prompt caching.

prompt_cache_retention'in_memory' | '24h'

Prompt cache retention policy.

previous_response_idstring

The id of a previous response, used to chain state across turns.

Example request

{
  "tools": [
    {
      "parameters": {
        "include_domains": [
          "octen.ai",
          "wikipedia.org"
        ],
        "exclude_domains": [
          "spam.com",
          "ads.example.net"
        ],
        "start_time": "2025-01-01T00:00:00+08:00",
        "end_time": "2025-01-01T00:00:00+08:00",
        "language": [
          "en",
          "zh"
        ]
      }
    }
  ]
}

Response

Successful chat completion. When stream=false, returns a single chat.completion object. When stream=true, returns a stream of chat.completion.chunk objects (search_done, content, finish, usage), followed by data: [DONE].

OR

Changes

No recorded changes to this operation across all 1 revision of this API.