curl --request POST \
--url https://models.relace.ai/v1/search/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "relace-search",
"messages": [
{
"role": "system",
"content": "You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ..."
},
{
"role": "user",
"content": "I have uploaded a code repository in the /repo directory.\n\nNow consider the following user query:\n\n<user_query>\nHow is user authentication handled in this codebase?\n</user_query>\n\n..."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "view_file",
"description": "Tool for viewing/exploring the contents of existing files",
"parameters": {
"type": "object",
"required": [
"path",
"view_range"
],
"properties": {
"path": {
"type": "string"
},
"view_range": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
},
{
"type": "function",
"function": {
"name": "report_back",
"description": "Report the relevant files once the codebase is understood",
"parameters": {
"type": "object",
"required": [
"explanation",
"files"
],
"properties": {
"explanation": {
"type": "string"
},
"files": {
"type": "object"
}
}
}
}
}
],
"tool_choice": "auto",
"stream": false
}
'import requests
url = "https://models.relace.ai/v1/search/chat/completions"
payload = {
"model": "relace-search",
"messages": [
{
"role": "system",
"content": "You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ..."
},
{
"role": "user",
"content": "I have uploaded a code repository in the /repo directory.
Now consider the following user query:
<user_query>
How is user authentication handled in this codebase?
</user_query>
..."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "view_file",
"description": "Tool for viewing/exploring the contents of existing files",
"parameters": {
"type": "object",
"required": ["path", "view_range"],
"properties": {
"path": { "type": "string" },
"view_range": {
"type": "array",
"items": { "type": "integer" }
}
}
}
}
},
{
"type": "function",
"function": {
"name": "report_back",
"description": "Report the relevant files once the codebase is understood",
"parameters": {
"type": "object",
"required": ["explanation", "files"],
"properties": {
"explanation": { "type": "string" },
"files": { "type": "object" }
}
}
}
}
],
"tool_choice": "auto",
"stream": False
}
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({
model: 'relace-search',
messages: [
{
role: 'system',
content: 'You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...'
},
{
role: 'user',
content: 'I have uploaded a code repository in the /repo directory.\n\nNow consider the following user query:\n\n<user_query>\nHow is user authentication handled in this codebase?\n</user_query>\n\n...'
}
],
tools: [
{
type: 'function',
function: {
name: 'view_file',
description: 'Tool for viewing/exploring the contents of existing files',
parameters: {
type: 'object',
required: ['path', 'view_range'],
properties: {path: {type: 'string'}, view_range: {type: 'array', items: {type: 'integer'}}}
}
}
},
{
type: 'function',
function: {
name: 'report_back',
description: 'Report the relevant files once the codebase is understood',
parameters: {
type: 'object',
required: ['explanation', 'files'],
properties: {explanation: {type: 'string'}, files: {type: 'object'}}
}
}
}
],
tool_choice: 'auto',
stream: false
})
};
fetch('https://models.relace.ai/v1/search/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://models.relace.ai/v1/search/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([
'model' => 'relace-search',
'messages' => [
[
'role' => 'system',
'content' => 'You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...'
],
[
'role' => 'user',
'content' => 'I have uploaded a code repository in the /repo directory.
Now consider the following user query:
<user_query>
How is user authentication handled in this codebase?
</user_query>
...'
]
],
'tools' => [
[
'type' => 'function',
'function' => [
'name' => 'view_file',
'description' => 'Tool for viewing/exploring the contents of existing files',
'parameters' => [
'type' => 'object',
'required' => [
'path',
'view_range'
],
'properties' => [
'path' => [
'type' => 'string'
],
'view_range' => [
'type' => 'array',
'items' => [
'type' => 'integer'
]
]
]
]
]
],
[
'type' => 'function',
'function' => [
'name' => 'report_back',
'description' => 'Report the relevant files once the codebase is understood',
'parameters' => [
'type' => 'object',
'required' => [
'explanation',
'files'
],
'properties' => [
'explanation' => [
'type' => 'string'
],
'files' => [
'type' => 'object'
]
]
]
]
]
],
'tool_choice' => 'auto',
'stream' => false
]),
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://models.relace.ai/v1/search/chat/completions"
payload := strings.NewReader("{\n \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\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://models.relace.ai/v1/search/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://models.relace.ai/v1/search/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 \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}Search Code
Run the Fast Agentic Search model (relace-search) one turn at a time through an OpenAI-compatible chat completions request. You supply the agent harness: the search tools and the code that executes them.
curl --request POST \
--url https://models.relace.ai/v1/search/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "relace-search",
"messages": [
{
"role": "system",
"content": "You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ..."
},
{
"role": "user",
"content": "I have uploaded a code repository in the /repo directory.\n\nNow consider the following user query:\n\n<user_query>\nHow is user authentication handled in this codebase?\n</user_query>\n\n..."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "view_file",
"description": "Tool for viewing/exploring the contents of existing files",
"parameters": {
"type": "object",
"required": [
"path",
"view_range"
],
"properties": {
"path": {
"type": "string"
},
"view_range": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
},
{
"type": "function",
"function": {
"name": "report_back",
"description": "Report the relevant files once the codebase is understood",
"parameters": {
"type": "object",
"required": [
"explanation",
"files"
],
"properties": {
"explanation": {
"type": "string"
},
"files": {
"type": "object"
}
}
}
}
}
],
"tool_choice": "auto",
"stream": false
}
'import requests
url = "https://models.relace.ai/v1/search/chat/completions"
payload = {
"model": "relace-search",
"messages": [
{
"role": "system",
"content": "You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ..."
},
{
"role": "user",
"content": "I have uploaded a code repository in the /repo directory.
Now consider the following user query:
<user_query>
How is user authentication handled in this codebase?
</user_query>
..."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "view_file",
"description": "Tool for viewing/exploring the contents of existing files",
"parameters": {
"type": "object",
"required": ["path", "view_range"],
"properties": {
"path": { "type": "string" },
"view_range": {
"type": "array",
"items": { "type": "integer" }
}
}
}
}
},
{
"type": "function",
"function": {
"name": "report_back",
"description": "Report the relevant files once the codebase is understood",
"parameters": {
"type": "object",
"required": ["explanation", "files"],
"properties": {
"explanation": { "type": "string" },
"files": { "type": "object" }
}
}
}
}
],
"tool_choice": "auto",
"stream": False
}
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({
model: 'relace-search',
messages: [
{
role: 'system',
content: 'You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...'
},
{
role: 'user',
content: 'I have uploaded a code repository in the /repo directory.\n\nNow consider the following user query:\n\n<user_query>\nHow is user authentication handled in this codebase?\n</user_query>\n\n...'
}
],
tools: [
{
type: 'function',
function: {
name: 'view_file',
description: 'Tool for viewing/exploring the contents of existing files',
parameters: {
type: 'object',
required: ['path', 'view_range'],
properties: {path: {type: 'string'}, view_range: {type: 'array', items: {type: 'integer'}}}
}
}
},
{
type: 'function',
function: {
name: 'report_back',
description: 'Report the relevant files once the codebase is understood',
parameters: {
type: 'object',
required: ['explanation', 'files'],
properties: {explanation: {type: 'string'}, files: {type: 'object'}}
}
}
}
],
tool_choice: 'auto',
stream: false
})
};
fetch('https://models.relace.ai/v1/search/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://models.relace.ai/v1/search/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([
'model' => 'relace-search',
'messages' => [
[
'role' => 'system',
'content' => 'You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...'
],
[
'role' => 'user',
'content' => 'I have uploaded a code repository in the /repo directory.
Now consider the following user query:
<user_query>
How is user authentication handled in this codebase?
</user_query>
...'
]
],
'tools' => [
[
'type' => 'function',
'function' => [
'name' => 'view_file',
'description' => 'Tool for viewing/exploring the contents of existing files',
'parameters' => [
'type' => 'object',
'required' => [
'path',
'view_range'
],
'properties' => [
'path' => [
'type' => 'string'
],
'view_range' => [
'type' => 'array',
'items' => [
'type' => 'integer'
]
]
]
]
]
],
[
'type' => 'function',
'function' => [
'name' => 'report_back',
'description' => 'Report the relevant files once the codebase is understood',
'parameters' => [
'type' => 'object',
'required' => [
'explanation',
'files'
],
'properties' => [
'explanation' => [
'type' => 'string'
],
'files' => [
'type' => 'object'
]
]
]
]
]
],
'tool_choice' => 'auto',
'stream' => false
]),
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://models.relace.ai/v1/search/chat/completions"
payload := strings.NewReader("{\n \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\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://models.relace.ai/v1/search/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://models.relace.ai/v1/search/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 \"model\": \"relace-search\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI agent whose job is to explore a code base with the provided tools and thoroughly understand the problem. ...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"I have uploaded a code repository in the /repo directory.\\n\\nNow consider the following user query:\\n\\n<user_query>\\nHow is user authentication handled in this codebase?\\n</user_query>\\n\\n...\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"view_file\",\n \"description\": \"Tool for viewing/exploring the contents of existing files\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"path\",\n \"view_range\"\n ],\n \"properties\": {\n \"path\": {\n \"type\": \"string\"\n },\n \"view_range\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"report_back\",\n \"description\": \"Report the relevant files once the codebase is understood\",\n \"parameters\": {\n \"type\": \"object\",\n \"required\": [\n \"explanation\",\n \"files\"\n ],\n \"properties\": {\n \"explanation\": {\n \"type\": \"string\"\n },\n \"files\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Rate limit exceeded. Retry after the Retry-After interval, or contact support to raise your limits.",
"type": "rate_limit_error",
"param": null,
"code": null
}
}report_back.
Models
| Model | Tools |
|---|---|
relace-search | view_file, view_directory, grep_search, bash, report_back |
OpenAI SDK
Point an OpenAI client at the/v1/search base URL. The model is also reachable as relace-search on the shared /v1/chat/completions route.
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://models.relace.ai/v1/search',
});
const response = await client.chat.completions.create({
model: 'relace-search',
messages: [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: userPrompt },
],
tools: searchTools,
tool_choice: 'auto',
});
Authorizations
Relace API key Authorization header using the Bearer scheme.
Body
OpenAI-compatible chat completions request with the Fast Agentic Search tool definitions
OpenAI-compatible request for one turn of the search agent. Fields outside this list are ignored.
Must be relace-search. This route serves only the Fast Agentic Search model.
The agent conversation so far, as OpenAI-format message objects: the system prompt, the user prompt, and any previous assistant tool calls with their tool results.
OpenAI-format function tool definitions. Use the exact view_file, view_directory, grep_search, bash, and report_back schemas from the agent harness guide; the model is trained against them.
Controls tool use: none, auto, required, or a specific tool. Use auto.
If true, tokens are sent as server-sent events as they are generated. Token usage is always reported in the final chunk of the stream.
Maximum number of tokens to generate for this turn.
Sequences at which generation stops.
Seed for deterministic sampling where supported.
Response
Chat completion generated
Unique identifier for the completion
Always chat.completion
Unix timestamp of when the completion was created
The model that served the request
The generated completions
Show child attributes
Show child attributes
Token usage information for the request
Show child attributes
Show child attributes