Commit cdc885
2024-08-22 16:03:54 admin: -/-chat api.md .. | |
@@ 1,43 1,32 @@ | |
- | ## Table of Contents |
- | |
- | * **[Introduction](#introduction)** |
- | * **[Authentication](#authentication)** |
- | * [Obtaining an API Key](#obtaining-an-api-key) |
- | * [Using the API Key](#using-the-api-key) |
- | * **[Endpoints](#endpoints)** |
- | * [`/models` - List Available Models](#models-list-available-models) |
- | * [`/chat/completions` - Generate Chat Completions](#chatcompletions-generate-chat-completions) |
- | * [Request Body](#request-body) |
- | * [Non-Streaming Response](#non-streaming-response) |
- | * [Streaming Response](#streaming-response) |
- | * [`/tokens` - Count Tokens](#tokens-count-tokens) |
- | * [`/credits` - Check Remaining Credits](#credits-check-remaining-credits) |
- | * [`/moderate` - Moderate Text](#moderate-moderate-text) |
- | * **[Supported Models](#supported-models)** |
- | * **[Usage Examples](#usage-examples)** |
- | * Non-Streaming Example (Python) |
- | * Streaming Example (Python) |
- | * Non-Streaming Example (C#) |
- | * Streaming Example (C#) |
- | * Non-Streaming Example (Node.js) |
- | * Streaming Example (Node.js) |
- | |
- | |
- | --- |
- | |
- | You'll need to add corresponding anchor tags (e.g., `<a name="introduction"></a>`) within your markdown document for each section you want to link to. This will allow users to click on the links in the table of contents and be taken directly to the relevant section. |
- | |
- | **Example of an anchor tag for the Introduction section:** |
- | |
- | |
- | Remember to replace the placeholder section titles and anchor names with the actual ones from your document. This approach allows for clickable links within a single markdown document. |
- | |
- | Please note that this method of creating clickable links within a markdown document may not be supported by all markdown renderers. Some platforms might require specific syntax or plugins to enable this functionality. You should check the documentation of your markdown renderer for more information. |
- | |
+ | ``` |
# chatapi.ai-now.space API Documentation | |
This API provides access to a variety of large language models (LLMs) for chat completions, token counting, and moderation. | |
+ | ## Table of Contents |
+ | |
+ | * [Authentication](#authentication) |
+ | * [Endpoints](#endpoints) |
+ | * [/models - List Available Models](#models) |
+ | * [/chat/completions - Generate Chat Completions](#chatcompletions) |
+ | * [Request Body](#chatcompletions-request-body) |
+ | * [Non-Streaming Response](#chatcompletions-non-streaming-response) |
+ | * [Streaming Response](#chatcompletions-streaming-response) |
+ | * [/tokens - Count Tokens](#tokens) |
+ | * [/credits - Check Remaining Credits](#credits) |
+ | * [/moderate - Moderate Text](#moderate) |
+ | * [Supported Models](#supported-models) |
+ | * [Usage Examples](#usage-examples) |
+ | * [Python](#usage-examples-python) |
+ | * [Non-Streaming Example](#usage-examples-python-non-streaming-example) |
+ | * [Streaming Example](#usage-examples-python-streaming-example) |
+ | * [C#](#usage-examples-c) |
+ | * [Non-Streaming Example](#usage-examples-c-non-streaming-example) |
+ | * [Streaming Example](#usage-examples-c-streaming-example) |
+ | * [Node.js](#usage-examples-nodejs) |
+ | * [Non-Streaming Example](#usage-examples-nodejs-non-streaming-example) |
+ | * [Streaming Example](#usage-examples-nodejs-streaming-example) |
+ | |
## Authentication | |
You need an API key to use this API. To obtain an API key, please contact `[email protected]`. | |
@@ 82,7 71,7 @@ | |
**Description:** Generates chat completions using the specified model. | |
- | **Request Body:** |
+ | #### Request Body |
```json | |
{ | |
@@ 102,7 91,7 @@ | |
} | |
``` | |
- | **Response (Non-Streaming):** |
+ | #### Non-Streaming Response |
```json | |
{ | |
@@ 130,7 119,7 @@ | |
} | |
``` | |
- | **Response (Streaming):** |
+ | #### Streaming Response |
```text | |
data: {"id": "chatcmpl-...", "object": "chat.completion.chunk", "created": 1677652288, "model": "MODEL_NAME", "choices": [{"index": 0, "delta": {"content": "The"}, "finish_reason": null}]} | |
@@ 239,9 228,11 @@ | |
Meta-Llama-3.1-405B-Instruct-Turbo | |
``` | |
- | ## Usage Examples Python |
+ | ## Usage Examples |
+ | |
+ | ### Python |
- | ### Non-Streaming Example (using `GPT-4 Turbo`): |
+ | #### Non-Streaming Example |
```python | |
import requests | |
@@ 264,7 255,7 @@ | |
print(response.json()) | |
``` | |
- | ### Streaming Example (using `Claude 3.5 Sonnet`): |
+ | #### Streaming Example |
```python | |
import requests | |
@@ 292,9 283,9 @@ | |
print(decoded_line[6:]) | |
``` | |
- | ## C# Examples |
+ | ### C# |
- | ### Non-Streaming Example (using `GPT-4 Turbo`): |
+ | #### Non-Streaming Example |
```csharp | |
using System; | |
@@ 335,7 326,7 @@ | |
} | |
``` | |
- | ### Streaming Example (using `Claude 3.5 Sonnet`): |
+ | #### Streaming Example |
```csharp | |
using System; | |
@@ 387,9 378,9 @@ | |
} | |
``` | |
- | ## Node.js Examples |
+ | ### Node.js |
- | ### Non-Streaming Example (using `GPT-4 Turbo`): |
+ | #### Non-Streaming Example |
```javascript | |
const axios = require('axios'); | |
@@ 416,7 407,7 @@ | |
}); | |
``` | |
- | ### Streaming Example (using `Claude 3.5 Sonnet`): |
+ | #### Streaming Example |
```javascript | |
const axios = require('axios'); | |
@@ 452,5 443,4 @@ | |
``` | |
**Remember to replace `YOUR_API_KEY` with your actual API key.** | |
- | |
- | These examples demonstrate how to interact with the `chatapi.ai-now.space` API using C# and Node.js for both streaming and non-streaming responses. You can adapt these examples to use different models and parameters as needed. |
+ | ``` |