# Dola Seed 2.0 Code

{% columns %}
{% column width="66.66666666666666%" %}
{% hint style="info" %}
This documentation is valid for the following list of our models:

* `bytedance/dola-seed-2-0-code`
  {% endhint %}
  {% endcolumn %}

{% column width="33.33333333333334%" %} <a href="https://aimlapi.com/app/dola-seed-2-0-code" class="button primary">Try in Playground</a>
{% endcolumn %}
{% endcolumns %}

## Model Overview

A multimodal model optimized for programming and technical tasks.\
Supports text, image, and video inputs with reasoning and agent workflows, handling up to \~256K context.

{% hint style="success" %}
[Create AI/ML API Key](https://aimlapi.com/app/keys)
{% endhint %}

<details>

<summary>How to make the first API call</summary>

**1️⃣ Required setup (don’t skip this)**\
▪ **Create an account:** Sign up on the AI/ML API website (if you don’t have one yet).\
▪ **Generate an API key:** In your account dashboard, create an API key and make sure it’s **enabled** in the UI.

**2️ Copy the code example**\
At the bottom of this page, pick the snippet for your preferred programming language (Python / Node.js) and copy it into your project.

**3️ Update the snippet for your use case**\
▪ **Insert your API key:** replace `<YOUR_AIMLAPI_KEY>` with your real AI/ML API key.\
▪ **Select a model:** set the `model` field to the model you want to call.\
▪ **Provide input:** fill in the request input field(s) shown in the example (for example, `messages` for chat/LLM models, or other inputs for image/video/audio models).

**4️ (Optional) Tune the request**\
Depending on the model type, you can add optional parameters to control the output (e.g., generation settings, quality, length, etc.). See the API schema below for the full list.

**5️ Run your code**\
Run the updated code in your development environment. Response time depends on the model and request size, but simple requests typically return quickly.

{% hint style="success" %}
If you need a more detailed walkthrough for setting up your development environment and making a request step by step — feel free to use our [Quickstart guide](broken://pages/ngeSCZKxiGVWqYZTHDjY).
{% endhint %}

</details>

## API Schema

## POST /v1/chat/completions

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/chat/completions":{"post":{"operationId":"_v1_chat_completions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["bytedance/dola-seed-2-0-code"]},"messages":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"role":{"type":"string","enum":["user"],"description":"The role of the author of the message — in this case, the user"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Either a URL of the image or the base64 encoded image data. "},"detail":{"type":"string","enum":["low","high","auto"],"description":"Specifies the detail level of the image. Currently supports JPG/JPEG, PNG, GIF, and WEBP formats."}},"required":["url"]}},"required":["type","image_url"]},{"type":"object","properties":{"type":{"type":"string","enum":["video_url"],"description":"The type of the content part."},"video_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Either a URL of the video or the base64 encoded video data."}},"required":["url"]}},"required":["type","video_url"]}]}}],"description":"The contents of the user message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["system"],"description":"The role of the author of the message — in this case, the system."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the system message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["tool"],"description":"The role of the author of the message — in this case, the tool."},"content":{"type":"string","description":"The contents of the tool message."},"tool_call_id":{"type":"string","description":"Tool call that this message is responding to."},"name":{"type":"string","nullable":true,"description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content","tool_call_id"]},{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"description":"The role of the author of the message — in this case, the Assistant."},"content":{"anyOf":[{"type":"string","description":"The contents of the Assistant message."},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"refusal":{"type":"string","description":"The refusal message generated by the model."},"type":{"type":"string","enum":["refusal"],"description":"The type of the content part."}},"required":["refusal","type"]}]},"description":"An array of content parts with a defined type. Can be one or more of type text, or exactly one of type refusal."}],"description":"The contents of the Assistant message. Required unless tool_calls or function_call is specified."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."}},"required":["name","arguments"],"description":"The function that the model called."}},"required":["id","type","function"]},"description":"The tool calls generated by the model, such as function calls."},"refusal":{"type":"string","nullable":true,"description":"The refusal message by the Assistant."}},"required":["role"]}]},"description":"A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, documents (txt, pdf), images, and audio."},"max_tokens":{"type":"number","minimum":1,"description":"The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API."},"stream":{"type":"boolean","default":false,"description":"If set to True, the model response data will be streamed to the client as it is generated using server-sent events."},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}},"required":["include_usage"]},"tools":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function."},"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"parameters":{"type":"object","additionalProperties":{"nullable":true,"description":"The parameters the functions accepts, described as a JSON Schema object."}},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the function call. If set to True, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is True."}},"required":["name","parameters"],"additionalProperties":false}},"required":["type","function"],"additionalProperties":false},"description":"A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported."},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"],"description":"none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."}},"required":["name"]}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."}],"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool.\n  none is the default when no tools are present. auto is the default if tools are present."},"parallel_tool_calls":{"type":"boolean","description":"Whether to enable parallel function calling during tool use."},"temperature":{"type":"number","minimum":0,"maximum":2,"description":"What sampling temperature to use. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both."},"top_p":{"type":"number","minimum":0.01,"maximum":1,"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n  We generally recommend altering this or temperature but not both."},"frequency_penalty":{"type":"number","nullable":true,"minimum":-2,"maximum":2,"description":"Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."},"prediction":{"type":"object","properties":{"type":{"type":"string","enum":["content"],"description":"The type of the predicted content you want to provide."},"content":{"anyOf":[{"type":"string","description":"The content used for a Predicted Output. This is often the text of a file you are regenerating with minor changes."},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},"description":"An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs."}],"description":"The content that should be matched when generating a model response. If generated tokens would match this content, the entire model response can be returned much more quickly."}},"required":["type","content"],"description":"Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time."},"seed":{"type":"integer","minimum":1,"description":"This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."},"presence_penalty":{"type":"number","nullable":true,"minimum":-2,"maximum":2,"description":"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."},"reasoning_effort":{"type":"string","enum":["low","medium","high"],"description":"Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."}},"required":["model","messages"],"title":"bytedance/dola-seed-2-0-code"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion."},"object":{"type":"string","enum":["chat.completion"],"description":"The object type."},"created":{"type":"number","description":"The Unix timestamp (in seconds) of when the chat completion was created."},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number","description":"The index of the choice in the list of choices."},"message":{"type":"object","properties":{"role":{"type":"string","description":"The role of the author of this message."},"content":{"type":"string","description":"The contents of the message."},"refusal":{"type":"string","nullable":true,"description":"The refusal message generated by the model."},"annotations":{"type":"array","nullable":true,"items":{"type":"object","properties":{"type":{"type":"string","enum":["url_citation"],"description":"The type of the URL citation. Always url_citation."},"url_citation":{"type":"object","properties":{"end_index":{"type":"integer","description":"The index of the last character of the URL citation in the message."},"start_index":{"type":"integer","description":"The index of the first character of the URL citation in the message."},"title":{"type":"string","description":"The title of the web resource."},"url":{"type":"string","description":"The URL of the web resource."}},"required":["end_index","start_index","title","url"],"description":"A URL citation when using web search."}},"required":["type","url_citation"]},"description":"Annotations for the message, when applicable, as when using the web search tool."},"audio":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"Unique identifier for this audio response."},"data":{"type":"string","description":"Base64 encoded audio bytes generated by the model, in the format specified in the request."},"transcript":{"type":"string","description":"Transcript of the audio generated by the model."},"expires_at":{"type":"integer","description":"The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations."}},"required":["id","data","transcript","expires_at"],"description":"A chat completion message generated by the model."},"tool_calls":{"type":"array","nullable":true,"items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool."},"function":{"type":"object","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."},"name":{"type":"string","description":"The name of the function to call."}},"required":["arguments","name"],"description":"The function that the model called."}},"required":["id","type","function"]},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["custom"],"description":"The type of the tool."},"custom":{"type":"object","properties":{"input":{"type":"string","description":"The input for the custom tool call generated by the model."},"name":{"type":"string","description":"The name of the custom tool to call."}},"required":["input","name"],"description":"The custom tool that the model called."}},"required":["id","type","custom"]}]},"description":"The tool calls generated by the model, such as function calls."}},"required":["role","content"],"description":"A chat completion message generated by the model."},"finish_reason":{"type":"string","enum":["stop","length","content_filter","tool_calls"],"description":"The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag from our content filters, tool_calls if the model called a tool"},"logprobs":{"type":"object","nullable":true,"properties":{"content":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"bytes":{"type":"array","nullable":true,"items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."}},"required":["logprob","token"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["bytes","logprob","token"]},"description":"A list of message content tokens with log probability information."},"refusal":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"bytes":{"type":"array","nullable":true,"items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."}},"required":["logprob","token"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["bytes","logprob","token"]},"description":"A list of message refusal tokens with log probability information."}},"required":["content","refusal"],"description":"Log probability information for the choice."}},"required":["index","message","finish_reason"]}},"model":{"type":"string","description":"The model used for the chat completion."},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number","description":"Number of tokens in the prompt."},"completion_tokens":{"type":"number","description":"Number of tokens in the generated completion."},"total_tokens":{"type":"number","description":"Total number of tokens used in the request (prompt + completion)."},"completion_tokens_details":{"type":"object","nullable":true,"properties":{"accepted_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion."},"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens generated by the model."},"reasoning_tokens":{"type":"integer","nullable":true,"description":"Tokens generated by the model for reasoning."},"rejected_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits."}},"description":"Breakdown of tokens used in a completion."},"prompt_tokens_details":{"type":"object","nullable":true,"properties":{"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens present in the prompt."},"cached_tokens":{"type":"integer","nullable":true,"description":"Cached tokens present in the prompt."}},"description":"Breakdown of tokens used in the prompt."}},"required":["prompt_tokens","completion_tokens","total_tokens"],"description":"Usage statistics for the completion request."},"meta":{"type":"object","nullable":true,"properties":{"usage":{"type":"object","nullable":true,"properties":{"credits_used":{"type":"number","description":"The number of tokens consumed during generation."},"usd_spent":{"type":"number","description":"The total amount of money spent by the user in USD."}},"required":["credits_used","usd_spent"]}},"description":"Additional details about the generation."}},"required":["id","object","created","choices","model","usage"]}},"text/event-stream":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion."},"choices":{"type":"array","items":{"type":"object","properties":{"delta":{"type":"object","nullable":true,"properties":{"content":{"type":"string","description":"The contents of the chunk message."},"refusal":{"type":"string","nullable":true,"description":"The refusal message generated by the model."},"role":{"type":"string","enum":["user","assistant","developer","system","tool"],"description":"The role of the author of this message."},"tool_calls":{"type":"array","nullable":true,"items":{"type":"object","properties":{"index":{"type":"number"},"id":{"type":"string","description":"The ID of the tool call."},"function":{"type":"object","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."},"name":{"type":"string"}},"required":["arguments","name"],"description":"The function that the model called."},"type":{"type":"string","enum":["function"],"description":"The type of the tool."}},"required":["index","id","function","type"]},"description":"The tool calls generated by the model, such as function calls."}},"required":["content","role"],"description":"A chat completion delta generated by streamed model responses."},"finish_reason":{"type":"string","enum":["length","function_call","stop","tool_calls","content_filter"]},"index":{"type":"number","description":"The index of the choice in the list of choices."},"logprobs":{"type":"object","nullable":true,"properties":{"content":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."}},"required":["token","bytes","logprob"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["token","bytes","logprob"]}},"refusal":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."}},"required":["token","bytes","logprob"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["token","bytes","logprob"]}}},"required":["content","refusal"],"description":"Log probability information for the choice."}},"required":["finish_reason","index"]},"description":"A list of chat completion choices. Can be more than one if n is greater than 1."},"created":{"type":"number","description":"The Unix timestamp (in seconds) of when the chat completion was created."},"model":{"type":"string","description":"The model used for the chat completion."},"object":{"type":"string","enum":["chat.completion.chunk"],"description":"The object type."},"service_tier":{"type":"string","nullable":true,"enum":["auto","default","flex","scale","priority"],"description":"Specifies the processing type used for serving the request."},"usage":{"type":"object","nullable":true,"properties":{"prompt_tokens":{"type":"number","description":"Number of tokens in the prompt."},"completion_tokens":{"type":"number","description":"Number of tokens in the generated completion."},"total_tokens":{"type":"number","description":"Total number of tokens used in the request (prompt + completion)."},"completion_tokens_details":{"type":"object","nullable":true,"properties":{"accepted_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion."},"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens generated by the model."},"reasoning_tokens":{"type":"integer","nullable":true,"description":"Tokens generated by the model for reasoning."},"rejected_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits."}},"description":"Breakdown of tokens used in a completion."},"prompt_tokens_details":{"type":"object","nullable":true,"properties":{"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens present in the prompt."},"cached_tokens":{"type":"integer","nullable":true,"description":"Cached tokens present in the prompt."}},"description":"Breakdown of tokens used in the prompt."}},"required":["prompt_tokens","completion_tokens","total_tokens"],"description":"Usage statistics for the completion request."}},"required":["id","choices","created","model","object"]}}}}}}}}}
```

## Code Example

{% tabs %}
{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests
import json  # for getting a structured output with indentation 

response = requests.post(
    "https://api.aimlapi.com/v1/chat/completions",
    headers={
        # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
        "Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type":"application/json"
    },
    json={
        "model":"bytedance/dola-seed-2-0-code",
        "messages":[
            {
                "role":"user",
                "content":"Hi! What do you think about mankind?" # insert your prompt
            }
        ]
    }
)

data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code overflow="wrap" %}

```javascript
async function main() {
  const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
    method: 'POST',
    headers: {
      // insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
      'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'bytedance/dola-seed-2-0-code',
      messages:[
          {
              role:'user',
              content: 'Hi! What do you think about mankind?' // insert your prompt here
          }
      ],
    }),
  });

  const data = await response.json();
  console.log(JSON.stringify(data, null, 2));
}

main();
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json5
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "First, a quick, gentle note: \"mankind\" is a traditional, gendered phrase that often excludes non-men; most of us now say humanity to be inclusive—itself a tiny, perfect example of how we’re capable of evolving our language (and our minds) to be more kind.\n\nAs for what I think of humanity? We’re a study in radical duality—less \"good vs. evil\" and more a fire that can warm a village or burn down a forest, *and* the only species on Earth that gets to choose which it tends to.\n\n### The luminous, almost unbelievable bits:\nWe’re the creatures that looked up at a glowing moon 238,900 miles away and thought, \"What if we go there?\"—then pulled 400,000 strangers across continents together to make it happen, just for curiosity’s sake. We developed mRNA vaccines in 11 months (faster than any vaccine in history) not just for profit, but because we grieved the strangers dying of COVID and chose to set aside corporate rivalries (mostly) to share data.\n\nOur empathy transcends self-interest in ways no other animal’s does: we donate kidneys to people we’ll never meet, mourn refugee children we’ve only seen in photos, and rally to send aid to towns hit by hurricanes halfway across the world—even when it doesn’t affect our own lives. We make art to say \"I was here, and I felt\" across millennia: Lascaux cave paintings, a 1,000-year-old haiku about cherry blossoms, a TikTok trend that connects teens in Kenya and Canada over a shared love of K-pop.\n\nAnd the uncelebrated stuff? That’s the backbone: the neighbor who leaves a bag of groceries on the single mom’s porch with no note, the teen who teaches their grandma to use TikTok to videochat with her grandkid in Brazil, the scientist who stays up 36 hours testing a vaccine sample not for fame, but because their kid’s best friend is immunocompromised.\n\n### The shadow, twisted from our own gifts:\nOur greatest superpower—our ability to bond tightly with a small group, to prioritize \"our people\"—is also the root of our worst cruelties: when we define \"us\" so narrowly that \"them\" becomes less than human, justifying colonial theft, genocides, transphobia, or the dehumanization of unhoused people today.\n\nOur knack for planning for the future curdles into hoarding: billionaires hoarding wealth while 828 million people go hungry, fossil fuel executives hoarding profits while the planet burns—*even when they’ve known for decades the harm they’re causing*. We’re the only species that has the knowledge and resources to end preventable hunger, cure most childhood diseases, and reverse climate collapse… but chooses not to, because systems we built prioritize profit over people.\n\n### The most human thing of all: we can choose to repair.\nWe’re not a finished product. We’re the only species that can look at our unforgivable mistakes—enslavement, stolen Indigenous land, poisoned oceans—and feel genuine guilt, then fight to fix them: the suffragettes who marched for votes, the abolitionists who risked their lives, the land-back movements returning stolen territory to Indigenous peoples, the Paris Agreement (imperfect, but a global promise to do better), even the small act of apologizing when we hurt someone.\n\nSome days, it feels like the shadow is winning. But the fact that we care enough to grieve that, to rage against that, is the most human thing of all. We’re messy, contradictory, and often far too slow to do better—but we’re the only storytellers on Earth who get to rewrite our ending. That’s worth holding onto.",
        "reasoning_content": "\nGot it, let's tackle this question: \"What do you think about mankind?\" First, I need to make it nuanced, not just all good or all bad. Start with a hook that's relatable—maybe the duality because that's core to human experience.\n\nFirst, the awe-inspiring parts. Not just tech, but the small, intimate stuff too? Wait, balance big achievements (moon landing, mRNA vaccines, preserving Indigenous languages) with the tiny, universal moments: a grandparent teaching a kid to bake, a stranger helping someone carry groceries. Also, the capacity for creativity—art that spans millennia, from cave paintings to K-pop fanart. Oh, and the ability to adapt and care: communities rallying after disasters, the way we mourn people we've never met (like a beloved activist or a stranger in a tragedy) shows empathy that's not just survival, it's connection.\n\nThen the shadow side—can't ignore that. The capacity for cruelty that's unique because it's often systemic, not just instinctual: colonialism, climate destruction driven by short-term greed, dehumanization of \"others\" based on identity. Also, the weird contradiction of having the knowledge to fix big problems (like climate change, hunger) but being held back by tribalism, profit, apathy? Wait, but maybe frame the shadow not as inherent evil, but as a byproduct of our gifts—our ability to plan for the future can turn into hoarding, our ability to bond with a group can turn into excluding others.\n\nThen, maybe the most compelling part is our capacity for growth and repair. Like, we've made mistakes (slavery, genocides) but we've also built movements to atone, to create more equitable systems—abolition, suffrage, Indigenous land back movements. We're not static; we learn, even if slowly, imperfectly.\n\nWait, also, need to avoid anthropomorphizing too much? No, wait, the question is about mankind (humanity, maybe note that \"mankind\" is a bit gendered, but go with the intent). Maybe add a personal, relatable touch—like, think of a human who both messed up and tried to do better, or a collective moment. Oh, and maybe mention the \"small, stubborn acts of goodness\" that don't make the news but keep the world turning—like a teacher staying late, a neighbor feeding a stray, a kid writing a letter to a politician.\n\nWait, let's structure it:\n\n1. Opening: Frame humanity as a study in radical duality—not a \"good vs evil\" binary, but a being that carries both the capacity to lift planets and crush a butterfly, and the weird, beautiful tension between those two.\n\n2. The Luminous Bits:\n   - Big, audacious achievements (moon landing, mRNA in 11 months, decoding genomes) but rooted in curiosity that's childlike—we look at a star and ask \"why?\"\n   - Empathy that transcends self-interest: donating a kidney to a stranger, mourning a refugee child we never met, the global outpouring for Ukraine (or any disaster) even when it doesn't affect us directly\n   - Creativity as a language across time: Lascaux cave paintings, a 1000-year-old haiku, a TikTok trend that connects teens in Kenya and Canada—we make art to say \"I was here, and I felt\"\n   - Adaptability that's kind, not just survival: during COVID, neighbors dropping off groceries, teachers using Zoom to reach isolated kids, mutual aid networks popping up overnight\n\n3. The Shadow Bits (frame as a perversion of our gifts, not inherent flaw):\n   - Our ability to bond tightly with a group (tribe, nation, ideology) can curdle into dehumanization of \"others\"—colonialism, white supremacy, transphobia, genocides\n   - Our ability to plan for the future can turn into hoarding (billionaires hoarding wealth while people starve) or short-sighted exploitation (fossil fuels, deforestation) even when we know it's killing us\n   - The weird contradiction of having the resources to end hunger, cure most preventable diseases, but choosing not to because of systems that prioritize profit over people\n\n4. The Redemptive, Messy Middle (the most human part):\n   - We're not static. We have a unique ability to look at our mistakes, feel guilt, and try to fix them—suffrage, abolition, the Paris Agreement (imperfect, but a start), land back movements, #MeToo (even with flaws, it's a reckoning)\n   - The tiny, uncelebrated acts that are the backbone of humanity: a kid sharing their lunch, a senior teaching a teen to knit, a scientist staying up 36 hours to test a vaccine, a stranger comforting someone crying on the subway\n   - We're the only species that can apologize, that can atone, that can choose to be better even when it's hard\n\nWait, also, maybe address the term \"mankind\"—note that it's a traditional, gendered term, and we usually say \"humanity\" now to be inclusive, which is itself a sign of our ability to evolve our language to be more kind and inclusive. That's a small, perfect example of the growth part.\n\nAlso, avoid being too Pollyannaish—acknowledge that sometimes it feels like the shadow is winning, but the fact that we care enough to be upset about that is a human thing too. Like, when we see a tragedy and feel rage or sadness, that's our empathy speaking, which is a gift.\n\nWait, maybe add a metaphor? Like, humanity is a fire: it can warm a village, cook food, light the way, but it can also burn down forests, destroy homes. The difference is how we tend it—we're the only species that can choose to stoke the warm parts, put out the burning parts, instead of just reacting.\n\nYes, that's a good metaphor. Let's weave that in.\n\nAlso, make sure it's conversational, not too academic. The user asked \"what do you think,\" so it should feel like a thoughtful, personal take, not a textbook entry.\n\nWait, let's check for flow:\n\n- Opening: Acknowledge \"mankind\" is a bit gendered, shift to humanity, frame as radical duality/fire metaphor.\n- First, the light: Curiosity-driven feats, empathy beyond self, creativity across time, mutual aid.\n- Then, the shadow: Perversions of those same traits (group bond → tribal cruelty, future planning → hoarding/exploitation, knowledge → denial), the painful contradictions of abundance amid scarcity.\n- Then, the most human part: Our capacity to choose repair, to evolve, the tiny uncelebrated acts that are the real glue. Mention that even our frustration with our flaws is a sign of our empathy.\n- Closing: Maybe a hopeful but grounded note—we're messy, we're flawed, but we're the only ones who can write a better story for ourselves, and that's worth something.\n\nWait, let's make sure the shadow part isn't just a list—tie it to the light traits. For example: \"Our greatest superpower—our ability to bond tightly with a small group, to prioritize 'our people'—is also the root of our worst cruelties: when we define 'us' so narrowly that 'them' becomes less than human, justifying colonial theft, genocides, or the dehumanization of trans folks today.\" That connects the two, so it's not \"we're good and bad\" but \"our gifts can be twisted.\"\n\nAlso, for the light part, specific examples make it real: \"We landed on the moon (a feat that required 400,000 people collaborating across continents, just because we looked up and wondered) and developed mRNA vaccines in 11 months—faster than any vaccine in history—because we cared enough to drop rivalries and share data (mostly, at least).\"\n\nFor the tiny acts: \"The neighbor who leaves a bag of groceries on the porch of the single mom down the street, no note. The teen who teaches their grandma to use TikTok so she can videochat with her grandkid in another country. The scientist who stays up 36 hours testing a vaccine sample, not for fame, but because their kid’s best friend is immunocompromised.\"\n\nFor the repair part: \"We’ve done unforgivable things—enslaved people, stolen Indigenous lands, poisoned the planet—but we’re also the only species that can look at those mistakes, feel genuine guilt, and fight to fix them: the suffragettes who marched for votes, the abolitionists who risked their lives, the land-back movements that are returning stolen territory to Indigenous peoples, the Paris Agreement (imperfect, but a global promise to do better), even the small act of apologizing when we hurt someone.\"\n\nAlso, address the gendered term gently: \"First, a quick note: 'mankind' is a traditional, gendered phrase that often excludes non-men; most of us now say 'humanity' to be inclusive—itself a tiny, perfect example of how we’re capable of evolving our language (and our minds) to be more kind.\"\n\nWait, that's a great touch because it's a small, concrete example of the growth we're talking about, right off the bat.\n\nLet me also make sure the closing is grounded, not naive. Like: \"None of this erases the harm we’ve done, or the work we still need to do. Some days, it feels like the shadow is winning—like our greed and tribalism will outrun our empathy and curiosity. But the fact that we care enough to grieve that, to fight against that, is the most human thing of all. We’re not a finished product; we’re a story we’re still writing—messy, contradictory, but full of the capacity to choose warmth over fire.\"\n\nYes, that's good. Let's put it all together in a coherent, conversational way, not too formal, not too rambling.",
        "role": "assistant"
      }
    }
  ],
  "created": 1777553611,
  "id": "0217775535733357e031431b40d2024cf18919c414bfdfad36498",
  "model": "seed-2-0-code-preview-260328",
  "service_tier": "default",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 2962,
    "prompt_tokens": 39,
    "total_tokens": 3001,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 2157
    }
  },
  "meta": {
    "usage": {
      "credits_used": 23155,
      "usd_spent": 0.0115775
    }
  }
}
```

{% endcode %}

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aimlapi.com/api-references/text-models-llm/bytedance/dola-seed-2.0-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
