Create a chat completion
curl --request POST \
--url https://inference.runanywhere.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "system",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"max_completion_tokens": 524288,
"max_tokens": 524288,
"n": 8,
"parallel_tool_calls": true,
"presence_penalty": 0,
"seed": 0,
"stop": "<string>",
"store": false,
"stream": false,
"temperature": 1,
"tools": [
{
"function": {
"name": "<string>",
"parameters": {
"properties": {},
"type": "object",
"$schema": "<string>",
"additionalProperties": true,
"required": [
"<string>"
]
},
"description": "<string>",
"strict": true
},
"type": "function"
}
],
"top_p": 0.5,
"user": "<string>"
}
'import requests
url = "https://inference.runanywhere.ai/v1/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "system",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"max_completion_tokens": 524288,
"max_tokens": 524288,
"n": 8,
"parallel_tool_calls": True,
"presence_penalty": 0,
"seed": 0,
"stop": "<string>",
"store": False,
"stream": False,
"temperature": 1,
"tools": [
{
"function": {
"name": "<string>",
"parameters": {
"properties": {},
"type": "object",
"$schema": "<string>",
"additionalProperties": True,
"required": ["<string>"]
},
"description": "<string>",
"strict": True
},
"type": "function"
}
],
"top_p": 0.5,
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: 'system', name: '<string>'}],
model: '<string>',
frequency_penalty: 0,
max_completion_tokens: 524288,
max_tokens: 524288,
n: 8,
parallel_tool_calls: true,
presence_penalty: 0,
seed: 0,
stop: '<string>',
store: false,
stream: false,
temperature: 1,
tools: [
{
function: {
name: '<string>',
parameters: {
properties: {},
type: 'object',
$schema: '<string>',
additionalProperties: true,
required: ['<string>']
},
description: '<string>',
strict: true
},
type: 'function'
}
],
top_p: 0.5,
user: '<string>'
})
};
fetch('https://inference.runanywhere.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inference.runanywhere.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'role' => 'system',
'name' => '<string>'
]
],
'model' => '<string>',
'frequency_penalty' => 0,
'max_completion_tokens' => 524288,
'max_tokens' => 524288,
'n' => 8,
'parallel_tool_calls' => true,
'presence_penalty' => 0,
'seed' => 0,
'stop' => '<string>',
'store' => false,
'stream' => false,
'temperature' => 1,
'tools' => [
[
'function' => [
'name' => '<string>',
'parameters' => [
'properties' => [
],
'type' => 'object',
'$schema' => '<string>',
'additionalProperties' => true,
'required' => [
'<string>'
]
],
'description' => '<string>',
'strict' => true
],
'type' => 'function'
]
],
'top_p' => 0.5,
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://inference.runanywhere.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://inference.runanywhere.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.runanywhere.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"finish_reason": "stop",
"index": 1,
"message": {
"content": "<string>",
"role": "assistant",
"reasoning_content": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "function",
"index": 63
}
]
},
"logprobs": null,
"matched_stop": "<string>"
}
],
"created": 1,
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"metadata": {
"weight_version": "<string>",
"weight_versions": [
{
"end": 1,
"start": 1,
"version": "<string>"
}
]
},
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1,
"completion_tokens_details": {
"accepted_prediction_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1,
"rejected_prediction_tokens": 1,
"text_tokens": 1
},
"prompt_tokens_details": {
"audio_tokens": 1,
"cached_tokens": 1,
"text_tokens": 1
},
"reasoning_tokens": 1
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}Create a chat completion
POST
/
chat
/
completions
Create a chat completion
curl --request POST \
--url https://inference.runanywhere.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "system",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"max_completion_tokens": 524288,
"max_tokens": 524288,
"n": 8,
"parallel_tool_calls": true,
"presence_penalty": 0,
"seed": 0,
"stop": "<string>",
"store": false,
"stream": false,
"temperature": 1,
"tools": [
{
"function": {
"name": "<string>",
"parameters": {
"properties": {},
"type": "object",
"$schema": "<string>",
"additionalProperties": true,
"required": [
"<string>"
]
},
"description": "<string>",
"strict": true
},
"type": "function"
}
],
"top_p": 0.5,
"user": "<string>"
}
'import requests
url = "https://inference.runanywhere.ai/v1/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "system",
"name": "<string>"
}
],
"model": "<string>",
"frequency_penalty": 0,
"max_completion_tokens": 524288,
"max_tokens": 524288,
"n": 8,
"parallel_tool_calls": True,
"presence_penalty": 0,
"seed": 0,
"stop": "<string>",
"store": False,
"stream": False,
"temperature": 1,
"tools": [
{
"function": {
"name": "<string>",
"parameters": {
"properties": {},
"type": "object",
"$schema": "<string>",
"additionalProperties": True,
"required": ["<string>"]
},
"description": "<string>",
"strict": True
},
"type": "function"
}
],
"top_p": 0.5,
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: 'system', name: '<string>'}],
model: '<string>',
frequency_penalty: 0,
max_completion_tokens: 524288,
max_tokens: 524288,
n: 8,
parallel_tool_calls: true,
presence_penalty: 0,
seed: 0,
stop: '<string>',
store: false,
stream: false,
temperature: 1,
tools: [
{
function: {
name: '<string>',
parameters: {
properties: {},
type: 'object',
$schema: '<string>',
additionalProperties: true,
required: ['<string>']
},
description: '<string>',
strict: true
},
type: 'function'
}
],
top_p: 0.5,
user: '<string>'
})
};
fetch('https://inference.runanywhere.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inference.runanywhere.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'role' => 'system',
'name' => '<string>'
]
],
'model' => '<string>',
'frequency_penalty' => 0,
'max_completion_tokens' => 524288,
'max_tokens' => 524288,
'n' => 8,
'parallel_tool_calls' => true,
'presence_penalty' => 0,
'seed' => 0,
'stop' => '<string>',
'store' => false,
'stream' => false,
'temperature' => 1,
'tools' => [
[
'function' => [
'name' => '<string>',
'parameters' => [
'properties' => [
],
'type' => 'object',
'$schema' => '<string>',
'additionalProperties' => true,
'required' => [
'<string>'
]
],
'description' => '<string>',
'strict' => true
],
'type' => 'function'
]
],
'top_p' => 0.5,
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://inference.runanywhere.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://inference.runanywhere.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.runanywhere.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"system\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"frequency_penalty\": 0,\n \"max_completion_tokens\": 524288,\n \"max_tokens\": 524288,\n \"n\": 8,\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0,\n \"seed\": 0,\n \"stop\": \"<string>\",\n \"store\": false,\n \"stream\": false,\n \"temperature\": 1,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {\n \"properties\": {},\n \"type\": \"object\",\n \"$schema\": \"<string>\",\n \"additionalProperties\": true,\n \"required\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"top_p\": 0.5,\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"finish_reason": "stop",
"index": 1,
"message": {
"content": "<string>",
"role": "assistant",
"reasoning_content": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "function",
"index": 63
}
]
},
"logprobs": null,
"matched_stop": "<string>"
}
],
"created": 1,
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"metadata": {
"weight_version": "<string>",
"weight_versions": [
{
"end": 1,
"start": 1,
"version": "<string>"
}
]
},
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1,
"completion_tokens_details": {
"accepted_prediction_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1,
"rejected_prediction_tokens": 1,
"text_tokens": 1
},
"prompt_tokens_details": {
"audio_tokens": 1,
"cached_tokens": 1,
"text_tokens": 1
},
"reasoning_tokens": 1
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "bad_request",
"param": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Required array length:
1 - 4096 elements- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Show child attributes
Show child attributes
An explicitly entitled Wally model identifier.
Required string length:
1 - 128Pattern:
^[A-Za-z0-9][A-Za-z0-9._:/-]*$Required range:
-2 <= x <= 2Required range:
1 <= x <= 1048576Required range:
1 <= x <= 1048576Required range:
1 <= x <= 16Required range:
-2 <= x <= 2Available options:
none, minimal, low, medium, high Show child attributes
Show child attributes
Required range:
-9223372036854776000 <= x <= 9223372036854776000Required string length:
1 - 4096Show child attributes
Show child attributes
Required range:
0 <= x <= 2Available options:
none, auto, required Required array length:
1 - 128 elementsShow child attributes
Show child attributes
Required range:
0 <= x <= 1Required string length:
1 - 256Response
A completion or an SSE stream when stream=true
Required array length:
1 - 16 elementsShow child attributes
Show child attributes
Required range:
x >= 0Required string length:
1 - 256Required string length:
1 - 128Show child attributes
Show child attributes
Required string length:
1 - 120Show child attributes
Show child attributes