> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gptproto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kimi-K2.5 - Text To Text - openai

> Engage with kimi k2.5 for advanced text to text tasks. Exceptional context handling and intelligent content creation at scale.

## Authentication

1. Sign up for a GPTProto account at [https://gptproto.com](https://gptproto.com)
2. Navigate to the API Keys section in your dashboard
3. Generate a new API key (sk-xxxxx)
4. Copy and securely store your API key
   For authentication details, please refer to the [Authentication](https://docs.gptproto.com/authentication) section.

## Initiate Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://gptproto.com/v1/chat/completions' \
  --header 'Authorization: GPTPROTO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kimi-k2.5",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  }'

  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');
  let data = JSON.stringify({
    "model": "kimi-k2.5",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://gptproto.com/v1/chat/completions',
    headers: { 
      'Authorization': 'GPTPROTO_API_KEY', 
      'Content-Type': 'application/json'
    },
    data : data
  };

  axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });


  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/v1/chat/completions"

  payload = json.dumps({
    "model": "kimi-k2.5",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": False
  })
  headers = {
    'Authorization': 'GPTPROTO_API_KEY',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)


  ```

  ```go Go theme={null}
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://gptproto.com/v1/chat/completions"
    method := "POST"

    payload := strings.NewReader(`{
    "model": "kimi-k2.5",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Authorization", "GPTPROTO_API_KEY")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }

  ```
</CodeGroup>

## Parameters

### Core Parameters

| Parameter                           | Type           | Required | Default | Range                                 | Description                                                                                                                                                              |
| ----------------------------------- | -------------- | -------- | ------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model`                             | string         | ✅ Yes    | -       | -                                     | Model ID used to generate the response, like `kimi-k2.5`.                                                                                                                |
| `messages`                          | array          | ✅ Yes    | -       | -                                     | A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and files. |
| `>messages.role`                    | string         | ✅ Yes    | -       | `system`<br />`user`<br />`assistant` | The role of the messages author.                                                                                                                                         |
| `>messages.content`                 | string / array | ✅ Yes    | -       | -                                     | The contents of the message. Can be a string for text-only messages or an array for multimodal content.                                                                  |
| `>>messages.content.type`           | string         | ✅ Yes    | -       | `text`<br />`image_url`<br />`file`   | The type of the content part.                                                                                                                                            |
| `>>messages.content.text`           | string         | ❌ No     | -       | -                                     | The text content.                                                                                                                                                        |
| `>>messages.content.image_url`      | object         | ❌ No     | -       | -                                     | The image URL content.                                                                                                                                                   |
| `>>messages.content.image_url.url`  | string         | ❌ No     | -       | -                                     | The URL of the image.                                                                                                                                                    |
| `>>messages.content.file`           | object         | ❌ No     | -       | -                                     | The file content for document analysis.                                                                                                                                  |
| `>>messages.content.file.filename`  | string         | ❌ No     | -       | -                                     | The name of the file.                                                                                                                                                    |
| `>>messages.content.file.file_data` | string         | ❌ No     | -       | -                                     | The URL of the file.                                                                                                                                                     |

### Advanced Parameters

| Parameter     | Type    | Required | Default | Range               | Description                                                                                             |
| ------------- | ------- | -------- | ------- | ------------------- | ------------------------------------------------------------------------------------------------------- |
| `max_tokens`  | integer | ❌ No     | -       | -                   | The maximum number of tokens to generate in the response.                                               |
| `temperature` | number  | ❌ No     | `0.95`  | `0.0` - `1.0`       | Controls randomness. Lower values make the model more focused and deterministic.                        |
| `top_p`       | number  | ❌ No     | `0.7`   | `0.0` - `1.0`       | Nucleus sampling parameter. The model considers the results of the tokens with top\_p probability mass. |
| `stream`      | boolean | ❌ No     | `false` | `true`<br />`false` | Whether to stream the response back incrementally using server-sent events.                             |
| `tools`       | array   | ❌ No     | -       | -                   | A list of tools the model may call. Use this to enable web search or function calling capabilities.     |
| `stop`        | array   | ❌ No     | -       | -                   | Up to 4 sequences where the API will stop generating further tokens.                                    |

## Response Example

```json theme={null}
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1699896916,
  "model": "kimi-k2.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I am Kimi K2.5, a large language model developed by Moonshot AI. I'm designed to assist with a wide range of tasks including answering questions, writing content, analyzing documents, and more."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 45,
    "total_tokens": 57
  }
}
```

## Error Codes

### Common Error Codes

| Error Code | Error Name               | Description                                                                                                       |
| ---------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| 401        | Unauthorized             | API key is missing or invalid                                                                                     |
| 403        | Forbidden                | Your API key doesn't have permission to access this resource, or insufficient balance for the requested operation |
| 429        | Too Many Requests        | You've exceeded your rate limit                                                                                   |
| 500        | Internal server error    | An internal server error occurred                                                                                 |
| 503        | Content policy violation | Content blocked due to safety concerns (actual status code is 400)                                                |
