curl --request POST \
--url https://api.orq.ai/v2/gateway/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"echo": false,
"frequency_penalty": 0,
"max_tokens": 16,
"presence_penalty": 0,
"seed": 123,
"stop": "<string>",
"temperature": 1,
"top_p": 1,
"user": "<string>",
"orq": {
"retry": {
"count": 3,
"on_codes": [
429,
500,
502
]
},
"fallbacks": [
{
"model": "openai/gpt-5"
},
{
"model": "anthropic/claude-4-opus"
}
],
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]"
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support"
]
},
"inputs": {
"customer_name": "John Smith",
"issue_type": "billing"
},
"cache": {
"ttl": 3600,
"type": "exact_match"
},
"knowledge_bases": [
{
"knowledge_id": "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"top_k": 5
}
],
"timeout": {
"call_timeout": 30000
}
},
"stream": false
}
'{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"text": "<string>"
}
],
"model": "<string>",
"object": "<string>",
"created": "<string>",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cache_creation_tokens": 123,
"audio_tokens": 123
},
"completion_tokens_details": {
"reasoning_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123,
"audio_tokens": 123
}
}
}For sending requests to legacy completion models
curl --request POST \
--url https://api.orq.ai/v2/gateway/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"echo": false,
"frequency_penalty": 0,
"max_tokens": 16,
"presence_penalty": 0,
"seed": 123,
"stop": "<string>",
"temperature": 1,
"top_p": 1,
"user": "<string>",
"orq": {
"retry": {
"count": 3,
"on_codes": [
429,
500,
502
]
},
"fallbacks": [
{
"model": "openai/gpt-5"
},
{
"model": "anthropic/claude-4-opus"
}
],
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]"
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support"
]
},
"inputs": {
"customer_name": "John Smith",
"issue_type": "billing"
},
"cache": {
"ttl": 3600,
"type": "exact_match"
},
"knowledge_bases": [
{
"knowledge_id": "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"top_k": 5
}
],
"timeout": {
"call_timeout": 30000
}
},
"stream": false
}
'{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"text": "<string>"
}
],
"model": "<string>",
"object": "<string>",
"created": "<string>",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cache_creation_tokens": 123,
"audio_tokens": 123
},
"completion_tokens_details": {
"reasoning_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123,
"audio_tokens": 123
}
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
ID of the model to use
The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
Echo back the prompt in addition to the completion
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
The maximum number of tokens that can be generated in the completion.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
-2 <= x <= 2If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Leverage Orq's intelligent routing capabilities to enhance your AI application with enterprise-grade reliability and observability. Orq provides automatic request management including retries on failures, model fallbacks for high availability, contact-level analytics tracking, conversation threading, and dynamic prompt templating with variable substitution.
Show child attributes
The name to display on the trace. If not specified, the default system name will be used.
Retry configuration for the request
Prompt configuration for the request
Information about the contact making the request. If the contact does not exist, it will be created automatically.
Show child attributes
Unique identifier for the contact
"contact_01ARZ3NDEKTSV4RRFFQ69G5FAV"
Display name of the contact
"Jane Doe"
Email address of the contact
URL to the contact's avatar or logo
"https://example.com/avatars/jane-doe.jpg"
A list of tags associated with the contact
["hr", "engineering"]
Thread information to group related requests
Show child attributes
Unique identifier of the knowledge base to search
"customer-knowledge-base"
The number of results to return. If not provided, will default to the knowledge base configured top_k.
1 <= x <= 100The threshold to apply to the search. If not provided, will default to the knowledge base configured threshold
0 <= x <= 1The type of search to perform. If not provided, will default to the knowledge base configured retrieval_type
vector_search, keyword_search, hybrid_search The metadata filter to apply to the search. Check the Searching a Knowledge Base for more information.
Additional search options
Show child attributes
Whether to include the vector in the chunk
Whether to include the metadata in the chunk
Whether to include the scores in the chunk
Override the rerank configuration for this search. If not provided, will use the knowledge base configured rerank settings.
Show child attributes
The name of the rerank model to use. Refer to the model list.
"cohere/rerank-multilingual-v3.0"
The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned
0 <= x <= 1The number of top results to return after reranking. If not provided, will default to the knowledge base configured top_k.
1 <= x <= 100Override the agentic RAG configuration for this search. If not provided, will use the knowledge base configured agentic RAG settings.
Show child attributes
The name of the model for the Agent to use. Refer to the model list.
The query to use to search the knowledge base. If not provided we will use the last user message from the messages of the requests
Array of models with weights for load balancing requests
[
{ "model": "openai/gpt-4o", "weight": 0.7 },
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
]
{
"retry": { "count": 3, "on_codes": [429, 500, 502] },
"fallbacks": [
{ "model": "openai/gpt-5" },
{ "model": "anthropic/claude-4-opus" }
],
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]"
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": ["customer-support"]
},
"inputs": {
"customer_name": "John Smith",
"issue_type": "billing"
},
"cache": { "ttl": 3600, "type": "exact_match" },
"knowledge_bases": [
{
"knowledge_id": "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"top_k": 5
}
],
"timeout": { "call_timeout": 30000 }
}
Represents a completion response from the API.
A unique identifier for the completion.
The list of completion choices the model generated for the input prompt.
The model used for the chat completion.
The object type
The Unix timestamp (in seconds) of when the chat completion was created.
This fingerprint represents the backend configuration that the model runs with.
Usage statistics for the completion request.
Show child attributes
Number of tokens in the generated completion.
Number of tokens in the prompt.
Total number of tokens used in the request (prompt + completion).
Show child attributes
The number of audio output tokens produced by the response.
Was this page helpful?