Skip to content

Proxy

Proxy requests to target endpoint through specified channel

from r9s import R9S
with R9S(api_key=os.getenv("R9S_API_KEY",""),) as r9_s:
res = r9_s.proxy.request(channelid="123", target="chat/completions", request_body={
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Hello",
},
],
})
# Handle response
print(res)
ParameterTypeRequiredDescriptionExample
channelidstr:heavy_check_mark:Channel ID
targetstr:heavy_check_mark:Target path
request_bodyobject:heavy_minus_sign:N/A
retriesobject:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Dict[str, Any]

Error TypeStatus CodeContent Type
errors.BadRequestError400application/json
errors.AuthenticationError401application/json
errors.PermissionDeniedError403application/json
errors.NotFoundError404application/json
errors.UnprocessableEntityError422application/json
errors.RateLimitError429application/json
errors.InternalServerError500application/json
errors.ServiceUnavailableError503application/json
errors.R9SDefaultError4XX, 5XX*/*