Chat
Overview
Section titled “Overview”Available Operations
Section titled “Available Operations”- create - Create chat completion
create
Section titled “create”Create a chat completion, supports streaming
Example Usage
Section titled “Example Usage”from r9s import R9Simport os
with R9S(api_key=os.getenv("R9S_API_KEY",""),) as r9_s: res = r9_s.chat.create( model="gpt-4o-mini", messages=[ { "role": "user", "content": "Hello, how are you?", }, ], stream=False)
print(res.choices[0].message)Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
model | str | :heavy_check_mark: | Model name |
messages | Array | :heavy_check_mark: | Messages list |
frequency_penalty | float | :heavy_minus_sign: | N/A |
logit_bias | object | :heavy_minus_sign: | N/A |
logprobs | bool | :heavy_minus_sign: | N/A |
top_logprobs | int | :heavy_minus_sign: | N/A |
max_tokens | int | :heavy_minus_sign: | N/A |
max_completion_tokens | int | :heavy_minus_sign: | N/A |
n | int | :heavy_minus_sign: | N/A |
presence_penalty | float | :heavy_minus_sign: | N/A |
response_format | object | :heavy_minus_sign: | N/A |
seed | float | :heavy_minus_sign: | N/A |
service_tier | string (auto, default) | :heavy_minus_sign: | N/A |
stop | string or Array | :heavy_minus_sign: | N/A |
stream | bool | :heavy_minus_sign: | N/A |
stream_options | object | :heavy_minus_sign: | N/A |
temperature | float | :heavy_minus_sign: | N/A |
top_p | float | :heavy_minus_sign: | N/A |
top_k | int | :heavy_minus_sign: | N/A |
tools | Array | :heavy_minus_sign: | N/A |
tool_choice | ChatCompletionRequestobjectChoice | :heavy_minus_sign: | N/A |
retries | object | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Section titled “Response”CreateChatCompletionResponse
Errors
Section titled “Errors”| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.UnprocessableEntityError | 422 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ServiceUnavailableError | 503 | application/json |
| errors.R9SDefaultError | 4XX, 5XX | */* |