LI.FI — Get a gas suggestion for the specified chain
Retrieve a gas suggestion for the specified chain with the LI.FI API. Supply a chain. Sample fields include availability and token information. Use it for on-chain or crypto market research. The GET request schema also lists fromChain, fromToken. Use the response in a DeFi workflow for the selected protocol, and compare the request and response with the provider example.
- Selected price
- $0 / callPublished pricing
- Sellers / APIs
- 1 / 1
- Requests · 30d
- —Loading...
- Success rate · 30d
- —Loading...
LI.FI — Get a gas suggestion for the specified chain
Prepare your request, then continue with your agent.
Selected price
$0 / call
- Provider
- Pricing
On this page
Playground
Run sends a real API request. Charges follow the published API contract.
Response structure
availablebooleanfromAmountstringlimitobjectamountstringamountUsdstringtokenobjectaddressstringchainIdintegercoinKeystringdecimalsintegerlogoURIstringnamestringpriceUSDstringsymbolstring
messagestringrecommendedobjectamountstringamountUsdstringtokenobjectaddressstringchainIdintegercoinKeystringdecimalsintegerlogoURIstringnamestringpriceUSDstringsymbolstring
// Inferred from response examples. Fields are optional and other fields may be returned.
export type ApiResponse = {
available?: boolean;
fromAmount?: string;
limit?: {
amount?: string;
amountUsd?: string;
token?: {
address?: string;
chainId?: number;
coinKey?: string;
decimals?: number;
logoURI?: string;
name?: string;
priceUSD?: string;
symbol?: string;
};
};
message?: string;
recommended?: {
amount?: string;
amountUsd?: string;
token?: {
address?: string;
chainId?: number;
coinKey?: string;
decimals?: number;
logoURI?: string;
name?: string;
priceUSD?: string;
symbol?: string;
};
};
};Sellers
| Seller | Pricing | Requests · 30d | Performance | Access |
|---|---|---|---|---|
lifiCurrent LI.FI — Get a gas suggestion for the specified chain · GET · View API reference | $0 / call | — | —successP50— |
- Unit price
- $0
Statistics use persisted gateway logs from the last 30 days up to now, including today.
Success rate = successful requests / all requests;
P50 = median latency of successful requests.
Prices reflect the published API contract. Contract revision: 3. Price update time: not supplied.
Total $0
API
- Method
- GET
- Endpoint
https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/{chain}- Content type
- application/json
- Authentication
Authorization: Bearer $OPENANY_API_KEY
curl \
'https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/10' \
-X GET \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H 'Content-Type: application/json'Input parameters
Fields in this listing; additional options and input encoding can vary by provider.
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
chain | URL path parameterspath | string | Yes | Chain from which gas prices should be shown (can be a chain id or a chain key) |
fromChain | URL query parametersquery | string | No | If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain. |
fromToken | URL query parametersquery | string | No | If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain. |
Required markers inside a nested object or variant apply when that object or variant is used.
Sample response
Sample response · Documented HTTP 200 Published documentation example. Verify the actual response after an approved call.
{
"available": false,
"fromAmount": "0",
"limit": {
"amount": "22837202716713635",
"amountUsd": "50.0000",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2189.41",
"symbol": "ETH"
}
},
"message": "Failed to calculate gas recommendation",
"recommended": {
"amount": "9134881086685",
"amountUsd": "0.0200",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2189.41",
"symbol": "ETH"
}
}
}Agent integration
Copy the resource contract without sharing an API key.
View API Markdown
# LI.FI — Get a gas suggestion for the specified chain
Retrieve a gas suggestion for the specified chain with the LI.FI API. Supply a chain. Sample fields include availability and token information. Use it for on-chain or crypto market research. The GET request schema also lists fromChain, fromToken. Use the response in a DeFi workflow for the selected protocol, and compare the request and response with the provider example.
## Available implementations
lifi · LI.FI — Get a gas suggestion for the specified chain: https://openany.si/markets/apis/capabilities/lifi-li-fi-get-a-gas-suggestion-for-the-specified-chain?offering=90eb52d1-36a8-492d-ba4a-08166a82eb59 · $0 / call
## Selected API contract
Documentation: https://openany.si/apis/90eb52d1-36a8-492d-ba4a-08166a82eb59
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/{chain}
Price: $0 / call
Provider: lifi
Contract revision: 3
Price source: OpenAny public API contract and documented provider unit rates. Price update time: not supplied.
Use OPENANY_API_KEY from the environment. API Key calls use your shared balance.
## Prepared request
```bash
curl \
'https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/10' \
-X GET \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H 'Content-Type: application/json'
```
## API contract
```json
{
"resource_type": "api",
"name": "LI.FI — Get a gas suggestion for the specified chain",
"endpoint": "https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/{chain}",
"method": "GET",
"content_type": "none",
"execution_mode": "sync",
"authentication": {
"type": "bearer",
"environment_variable": "OPENANY_API_KEY"
},
"inputs": [
{
"description": "Chain from which gas prices should be shown (can be a chain id or a chain key)",
"location": "path",
"name": "chain",
"nullable": false,
"required": true,
"type": "string"
},
{
"description": "If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.",
"location": "query",
"name": "fromChain",
"nullable": false,
"required": false,
"type": "string"
},
{
"description": "If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.",
"location": "query",
"name": "fromToken",
"nullable": false,
"required": false,
"type": "string"
}
],
"billing": {
"currency": "USD",
"mode": "fixed",
"priceMicroUsd": "0",
"rounding": null,
"unit": "call",
"unitQuantity": null
},
"examples": [
{
"http_status": 200,
"name": "Documentation example",
"request": {
"body": null,
"headers": {},
"path": {
"chain": "10"
},
"query": {}
},
"response_body": {
"available": false,
"fromAmount": "0",
"limit": {
"amount": "22837202716713635",
"amountUsd": "50.0000",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2189.41",
"symbol": "ETH"
}
},
"message": "Failed to calculate gas recommendation",
"recommended": {
"amount": "9134881086685",
"amountUsd": "0.0200",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 10,
"coinKey": "ETH",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"name": "ETH",
"priceUSD": "2189.41",
"symbol": "ETH"
}
}
}
}
]
}
```Error handling
| Status | Next step |
|---|---|
400 | Check the offering and request fields. |
401 / 403 | Verify your credentials and access permissions. |
402 | Inspect the selected access mode and returned payment requirements. |
429 | Respect the returned rate limit and retry guidance. |
5xx | Inspect the error and usage record before retrying a paid operation. |
Examples
Documentation example
Published documentation example. Verify the actual response after an approved call.
Prepare your environment
Use a terminal with cURL installed.
Use an OpenAny API key with shared-balance access. Confirm availability and price before running; a call may charge your balance.
Set the key in your terminal using the hidden prompt below. Keep its value out of source files and logs.
Terminal · macOS / Linuxprintf 'OpenAny API key: ' read -r -s OPENANY_API_KEY export OPENANY_API_KEY printf '\n'Run the request
Paste the complete command below into your terminal.
Values to replace before running 3
Review these request fields before running. Keep the published provider and request method unchanged.
chain- Chain from which gas prices should be shown (can be a chain id or a chain key)
fromChain- If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.
fromToken- If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.
Terminal · cURLcurl \ 'https://api.openany.si/v1/agent-apis/lifi/v1/gas/suggestion/10' \ -X GET \ -H "Authorization: Bearer $OPENANY_API_KEY" \ -H 'Content-Type: application/json'Check the response
Sample response · Documented HTTP 200
Sample response{ "available": false, "fromAmount": "0", "limit": { "amount": "22837202716713635", "amountUsd": "50.0000", "token": { "address": "0x0000000000000000000000000000000000000000", "chainId": 10, "coinKey": "ETH", "decimals": 18, "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png", "name": "ETH", "priceUSD": "2189.41", "symbol": "ETH" } }, "message": "Failed to calculate gas recommendation", "recommended": { "amount": "9134881086685", "amountUsd": "0.0200", "token": { "address": "0x0000000000000000000000000000000000000000", "chainId": 10, "coinKey": "ETH", "decimals": 18, "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png", "name": "ETH", "priceUSD": "2189.41", "symbol": "ETH" } } }