This API is accessible only from Forge applications and requires platform-provided authentication headers. It enables Forge apps to interact with native Forge-supported LLMs. For more information, see the Forge LLMs documentation
Proxy endpoint to make requests to the native Forge supported LLMs.
Forge and OAuth2 apps cannot access this REST resource.
LLMs
Requiredstring
Requiredarray<oneOf [System message, User message, Assistant message, Tool message]>
Requirednumber
number
number
array<LLMTool>
oneOf [string, LLMToolObject]
Successful response
Response Payload from LLM requests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
curl --request POST \
--url '{FORGE_EGRESS_PROXY_URL}/forge/llm/{model}' \
--header 'Accept: application/json' \
--header 'forge-proxy-authorization: Forge as=app,id=invocation-123' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant that helps people find out the weather."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is the weather like in Boston today?"
}
]
}
],
"top_p": 0.5,
"max_completion_tokens": 200,
"temperature": 0.9,
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}
]
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"choices": [
{
"message": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "To help you find the weather in Boston today, I will use the get_current_weather function."
}
],
"tool_calls": [
{
"id": "tooluse_BnyEynAYSwmA4rAjNy6sUA,",
"type": "function,",
"function": {
"name": "get_current_weather,",
"arguments": "{\"location\": \"Boston, MA\", \"unit\": \"celsius\"}"
}
}
]
},
"finish_reason": "stop",
"index": 0
}
],
"usage": {
"input_tokens": 20,
"output_tokens": 15,
"total_tokens": 35
}
}Rate this page: