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

# Get Price Estimate

> Get a price estimate for a market order

## Query Parameters

<ParamField query="gpu_type" type="string" required>
  GPU type: `h100`, `h200`, `b200`, or `b300`
</ParamField>

<ParamField query="gpu_count" type="integer" required>
  Number of GPUs (must be multiple of 8)
</ParamField>

<ParamField query="zone" type="string" required>
  Availability zone: `us-west-1`, `us-east-1`, or `eu-west-1`
</ParamField>

<ParamField query="duration_hours" type="integer" default="24">
  Lease duration in hours for cost calculation
</ParamField>

## Response

<ResponseField name="estimated_price" type="number">
  Weighted average price per GPU/hour
</ResponseField>

<ResponseField name="best_ask" type="number">
  Current best ask price
</ResponseField>

<ResponseField name="worst_fill_price" type="number">
  Highest price you'd pay if order filled now
</ResponseField>

<ResponseField name="total_cost" type="number">
  Estimated total cost including platform fee
</ResponseField>

<ResponseField name="sufficient_liquidity" type="boolean">
  Whether there's enough liquidity to fill the order
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.galadriel.com/v1/prices/estimate?gpu_type=h100&gpu_count=16&zone=us-west-1&duration_hours=24" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.galadriel.com/v1/prices/estimate",
      headers={"Authorization": "Bearer YOUR_API_TOKEN"},
      params={
          "gpu_type": "h100",
          "gpu_count": 16,
          "zone": "us-west-1",
          "duration_hours": 24
      }
  )

  estimate = response.json()
  print(f"Estimated price: ${estimate['estimated_price']}/hr")
  print(f"Total cost: ${estimate['total_cost']}")
  print(f"Liquidity: {'✓' if estimate['sufficient_liquidity'] else '✗'}")
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    gpu_type: 'h100',
    gpu_count: '16',
    zone: 'us-west-1',
    duration_hours: '24'
  });

  const response = await fetch(
    `https://api.galadriel.com/v1/prices/estimate?${params}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN'
      }
    }
  );

  const estimate = await response.json();
  console.log(`Estimated price: $${estimate.estimated_price}/hr`);
  console.log(`Total cost: $${estimate.total_cost}`);
  ```
</RequestExample>

<ResponseExample>
  ```json Sufficient Liquidity theme={null}
  {
    "gpu_type": "h100",
    "gpu_count": 16,
    "zone": "us-west-1",
    "duration_hours": 24,
    "estimated_price": 1.38,
    "best_ask": 1.40,
    "worst_fill_price": 1.45,
    "total_available": 48,
    "sufficient_liquidity": true,
    "cost_breakdown": {
      "compute_cost": 530.88,
      "platform_fee": 53.09,
      "total_cost": 583.97
    },
    "fills": [
      {
        "price": 1.40,
        "gpus": 16
      }
    ],
    "timestamp": "2025-11-11T14:00:00Z"
  }
  ```

  ```json Insufficient Liquidity theme={null}
  {
    "gpu_type": "h100",
    "gpu_count": 64,
    "zone": "us-west-1",
    "duration_hours": 24,
    "estimated_price": 1.42,
    "best_ask": 1.40,
    "worst_fill_price": 1.50,
    "total_available": 48,
    "sufficient_liquidity": false,
    "cost_breakdown": {
      "compute_cost": 2182.08,
      "platform_fee": 218.21,
      "total_cost": 2400.29
    },
    "fills": [
      {
        "price": 1.40,
        "gpus": 16
      },
      {
        "price": 1.45,
        "gpus": 8
      },
      {
        "price": 1.50,
        "gpus": 24
      }
    ],
    "missing_gpus": 16,
    "timestamp": "2025-11-11T14:00:00Z"
  }
  ```
</ResponseExample>

## Using Price Estimates

Use price estimates to decide between market and limit orders:

```python theme={null}
estimate = response.json()

if not estimate['sufficient_liquidity']:
    print("Not enough liquidity. Use limit order instead.")
elif estimate['estimated_price'] > 1.50:
    print("Price too high. Wait or use limit order.")
else:
    print(f"Good price. Proceed with market order at ~${estimate['estimated_price']}/hr")
```
