> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Proxy an LLM inference request

> Forwards an inference request to a supported LLM provider from within the sandbox context

Forwards an inference request to a supported LLM provider from within the sandbox context

### Path parameters

<ParamField path="sandboxId" type="string (uuid)" required>
  Unique sandbox identifier
</ParamField>

### Request body

`InferenceRequest`

<ParamField body="provider" type="string" required>
  LLM provider to route the request to
</ParamField>

<ParamField body="path" type="string" required>
  API path on the provider (e.g., '/v1/messages')
</ParamField>

<ParamField body="body" type="object" required>
  Request body to forward to the provider
</ParamField>

<ParamField body="secret_name" type="string">
  Name of the stored secret containing the provider API key
</ParamField>

<ParamField body="headers" type="object">
  Additional headers to include in the provider request
</ParamField>

### Response

`InferenceResponse`

<ResponseField name="status" type="integer">
  HTTP status code from the provider
</ResponseField>

<ResponseField name="body" type="object">
  Response body from the provider
</ResponseField>

<ResponseField name="headers" type="object">
  Response headers from the provider
</ResponseField>

### Status codes

| Code  | Meaning                          |
| ----- | -------------------------------- |
| `200` | Inference response from provider |
| `400` | —                                |
| `401` | —                                |
| `404` | —                                |
| `500` | —                                |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.sandbox.stateset.app/api/v1/sandbox/{sandboxId}/inference' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "provider": "anthropic",
    "path": "string",
    "body": {},
    "secret_name": "string",
    "headers": {}
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "status": 1,
    "body": {},
    "headers": {}
  }
  ```
</ResponseExample>
