Skip to Content
API ReferenceOpenAI Compatible

OpenAI Compatible API

Use this interface to call Ant Ling models, supporting multi-turn conversations, long-range tasks, and other conversation scenarios. The interface format is fully compatible with OpenAI chat/completions — you can integrate directly using the OpenAI SDK.

Request Address

MethodURL
POSThttps://api.ant-ling.com/v1/chat/completions

Authorization

Authorization

  • Type: HTTP Bearer Auth, value type string
  • Required
  • Description: Used to verify account information. Go to API Console , click Create Token to obtain.
Authorization: Bearer <YOUR_API_KEY>

Request Headers

Content-Type

  • Type: enum<string>
  • Required, fixed value application/json
  • Description: The media type of the request body. Must be application/json.

Request Body

Overview

ParameterTypeRequiredDefaultDescription
modelstringYesModel ID
messagesobject[]YesMessage list
streambooleanNofalseWhether to enable streaming output
toolslistNoTool list (Function Calling)
temperaturedoubleNo1Randomness, range [0.0, 1.0]
top_pdoubleNo1Diversity, range (0.0, 1.0]
enable_searchbooleanNofalseWhether to enable web search
search_optionsobjectNoWeb search strategy

model

  • Type: string
  • Required
  • Description: The ID of the model to call.
  • Options: Ling-2.6-1T, Ling-2.6-flash, Ling-2.5-1T, Ling-1T, Ring-2.5-1T, Ring-1T

messages

  • Type: object[]
  • Required
  • Description: The list of messages provided to the model, in conversation order.
[ { "role": "user", "content": "Hello" } ]

messages.role

  • Type: string
  • Required
  • Description: The role of the message sender.
  • Options: system (system prompt), user (user), assistant (assistant)

messages.content

  • Type: string
  • Required
  • Description: The content of the message sent to the model.
  • Example: Hello, Ant Ling

stream

  • Type: boolean
  • Optional, default false
  • Description: When set to true, enables streaming output. The server returns content chunk by chunk in SSE format.

The timeout for non-streaming calls is 90 seconds. For longer generation tasks, it is recommended to enable stream: true to avoid timeouts.


tools

  • Type: list
  • Optional
  • Description: Tool list (Function Calling). The model may call these tools in its response.
[ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] } }, "required": ["location"] } } } ]

temperature

  • Type: double
  • Optional, default 1
  • Description: Controls the randomness of the output. Range [0.0, 1.0] — lower values produce more deterministic output, higher values produce more varied output.

top_p

  • Type: double
  • Optional, default 1
  • Description: Nucleus sampling probability threshold. Range (0.0, 1.0] — lower values make the model more likely to select high-probability tokens.

  • Type: boolean
  • Optional, default false
  • Description: Whether to allow the model to use web search.

Enabling web search will increase Token consumption. Enable it only as needed.


search_options

  • Type: object
  • Optional
  • Description: Web search strategy configuration. Only takes effect when enable_search: true.

  • Type: boolean
  • Optional, default false
  • Description: Whether to force a web search on every request. When set to true, the model no longer decides whether to search — it always performs a search.

Request and Response


Request Example

curl --request POST \ --url https://api.ant-ling.com/v1/chat/completions \ --header 'Authorization: Bearer <YOUR_API_KEY>' \ --header 'Content-Type: application/json' \ --data '{ "model": "Ling-2.6-flash", "stream": true, "messages": [ { "role": "user", "content": "What opportunities and challenges will the large language model industry face in 2025?" } ] }'

Response Example

Streaming responses are returned in SSE  format. Each line is prefixed with data:, and the stream ends with data: [DONE].

data: {"choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"created":1761122942,"id":"0a4244f3...","model":"Ling-2.6-flash","object":"chat.completion.chunk"} data: {"choices":[{"delta":{"content":"Hello","role":"assistant"},"index":0}],"created":1761122942,"id":"0a4244f3...","model":"Ling-2.6-flash","object":"chat.completion.chunk"} data: {"choices":[{"delta":{"content":"! Is there anything I can help you with?","role":"assistant"},"index":0}],"created":1761122943,"id":"0a4244f3...","model":"Ling-2.6-flash","object":"chat.completion.chunk"} data: {"choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":"stop","index":0}],"created":1761122943,"id":"0a4244f3...","model":"Ling-2.6-flash","object":"chat.completion.chunk","usage":{"completion_tokens":20,"prompt_tokens":19,"total_tokens":39}} data: [DONE]
Was this page helpful?
Last updated on