# Table of Contents - [Overview | The Grid](#overview-the-grid) - [Onboarding Guides | The Grid](#onboarding-guides-the-grid) - [Getting Started | The Grid](#getting-started-the-grid) - [Supplying to The Grid | The Grid](#supplying-to-the-grid-the-grid) - [Buying Units Programmatically | The Grid](#buying-units-programmatically-the-grid) - [Trading and Consumption Accounts | The Grid](#trading-and-consumption-accounts-the-grid) - [Working with Trading and Consumption Balances | The Grid](#working-with-trading-and-consumption-balances-the-grid) - [Tokens and Metering | The Grid](#tokens-and-metering-the-grid) - [Instruments | The Grid](#instruments-the-grid) - [Evolution of Specifications | The Grid](#evolution-of-specifications-the-grid) - [Lifecycle of a Unit | The Grid](#lifecycle-of-a-unit-the-grid) - [Design Advantages | The Grid](#design-advantages-the-grid) - [Central Limit Order Book (CLOB) and Scheduled Sweeps | The Grid](#central-limit-order-book-clob-and-scheduled-sweeps-the-grid) - [Lots and Consumption Window | The Grid](#lots-and-consumption-window-the-grid) - [Units | The Grid](#units-the-grid) --- # Overview | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send [Check out our Manifesto arrow-up-right](https://thegrid.ai/manifesto) for Our Vision of the Future of Inference Financialization. The Grid is a market for AI inference. It treats inference as a standardized commodity and lets suppliers and buyers meet in a single real-time market. Instead of buying access to a specific model from a specific provider, you buy Units of standardized Instruments. The specs for a given Instrument guarantee a minimum level of quality and reliability. Your purchased units can then be consumed via the standard completions API. ### [hashtag](https://thegrid.ai/docs#why-inference-needs-a-market) **Why inference needs a market** Today, inference capacity is fragmented. * Each provider publishes its own pricing menus, with opaque backdoor negotiations with enterprises for custom pricing. * Every model has its own API, quotas, and fine print. * Capacity is over-provisioned because demand is hard to predict. * Unused GPU time disappears forever. Inference cannot be stored. Every idle GPU minute is lost production. This makes inference more perishable than electricity and more like a throughput constrained commodity. The Grid addresses that by: * Standardizing what is being sold through Instruments and Units. * Creating a single market where prices emerge from bids and asks. * Tying every trade to a near term delivery window. * Making delivery auditable so developers and suppliers can trust the system. ### [hashtag](https://thegrid.ai/docs#what-you-can-do-with-the-grid) **What you can do with The Grid** As a developer building AI apps, or as researcher generating synthetic data using AI inference, you can: * Choose an Instrument for your use case (for example - Chat Fast - if you’re building an AI chat assistant) instead of choosing specific models. * Buy Units at real-time market prices, where multiple Suppliers compete to serve you inference * Run workloads against your balance, with clear rate limits and predictable performance using the Consumption API (which uses the Chat Completions API standard) Suppliers will be able to: * Issue Units of 1M tokens, serving models that conform to the Instrument Benchmarks. * Sell Units on the exchange and see the market consuming inference within tight windows, instead of vague usage based commitments. Suppliers can use our UI or Trading API to set their own programmatic sell orders, or contract with us to aggregate capacity with other suppliers. * Compete on pricing power with other suppliers in a real-time market. circle-info Currently, The Grid is serving as a supplier on the platform, and several other suppliers will be onboarded in due course. If youre interested in becoming a supplier, please reach out to us at [\[email protected\]](https://thegrid.ai/cdn-cgi/l/email-protection) ### [hashtag](https://thegrid.ai/docs#how-the-docs-are-organized) **How the docs are organized** Dive into the following focussed pages to learn more about The Grid: 1. [**Core Concepts**](https://thegrid.ai/docs/core-concepts) - The mental model for Instruments, Units, and Trading and Consumption Accounts. 2. [**Instruments and Benchmarks**](https://thegrid.ai/docs/instruments-and-specifications) - How our current Instruments are defined, how we measure quality, and how benchmarks evolve. 3. [**Market Mechanics**](https://thegrid.ai/docs/market-mechanics) - How the order book works, how prices are formed, and how trading by consumers results in predictable demand for suppliers. 4. [**Consumption, Delivery and Metering**](https://thegrid.ai/docs/consumption-delivery-and-metering) - How tokens are consumed from the Units you hold in your Consumption Account, how the API queues Lots for consumption and how tokens and metrics are metered. [NextCore Conceptschevron-right](https://thegrid.ai/docs/core-concepts) Last updated 5 days ago Was this helpful? * [Why inference needs a market](https://thegrid.ai/docs#why-inference-needs-a-market) * [What you can do with The Grid](https://thegrid.ai/docs#what-you-can-do-with-the-grid) * [How the docs are organized](https://thegrid.ai/docs#how-the-docs-are-organized) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Onboarding Guides | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good evening I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send Guides in this section are ready to use scripts in JavaScript, Python and Go that can help you automate your inference buying and consumption on The Grid. These scripts cover common production use cases, such as: 1. [Querying Trading Account and Consumption Account balances](https://thegrid.ai/docs/onboarding-guides/working-with-trading-and-consumption-balances) 2. [Replenishing consumption balance automatically, to avoid running out of tokens mid-traffic](https://thegrid.ai/docs/onboarding-guides/replenishing-consumption-account-balance) 3. [Retries and error handling](https://thegrid.ai/docs/onboarding-guides/retries-and-error-handling) 4. [Batch sequencing for asynchronous, cost optimized workloads](https://thegrid.ai/docs/onboarding-guides/batch-sequencing-with-limit-orders) As you move your workloads from other inference providers/aggregators to The Grid, we recommend implementing our [Best Practices](https://thegrid.ai/docs/onboarding-guides/best-practices) for uninterrupted, efficient and performant inference consumption. [PreviousSupplying to The Gridchevron-left](https://thegrid.ai/docs/getting-started/supplying-to-the-grid) [NextWorking with Trading and Consumption Balanceschevron-right](https://thegrid.ai/docs/onboarding-guides/working-with-trading-and-consumption-balances) Last updated 4 days ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Getting Started | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good evening I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send The Grid is a market for AI inference. It treats inference as a standardized commodity called an Instrument, and lets suppliers and buyers meet in a single real-time market. * If you are interested in consuming inference, continue to [**Getting Started as a Consumer**](https://thegrid.ai/docs/getting-started/getting-started-as-a-consumer) * If you are interested in becoming a Supplier, continue to [**Supplying to The Grid**](https://thegrid.ai/docs/getting-started/supplying-to-the-grid) [PreviousConsumption, Delivery and Meteringchevron-left](https://thegrid.ai/docs/consumption-delivery-and-metering) [NextGetting started as a Consumerchevron-right](https://thegrid.ai/docs/getting-started/getting-started-as-a-consumer) Last updated 5 days ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Supplying to The Grid | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good evening I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send circle-info Fill out this form to express your interest in joining us as a Supplier. We run a lightweight but deliberate process to ensure high-quality inference is delivered on The Grid. We evaluate you based on the following parameters during onboarding, and also perform continuous evaluations (SLA reviews, secret shopper style programs, etc.) once you've started supplying on the platform: **Spec fit:** * Whether you can supply inference for any current [Instrument specificationsarrow-up-right](https://thegrid.ai/docs/instruments-and-specifications/instrument-specifications-as-of-jan-2026) **Operational maturity:** * Uptime expectations, observability, incident response, and on-call support * Ability to sustain performance during demand spikes or partial outages **Collaboration readiness:** * Willingness to partner on rollout, remediation, and continuous improvement **Compliance constraints:** * Compliance with local jurisdiction requirements for data storage, retrieval, and usage [PreviousBuying Units Programmaticallychevron-left](https://thegrid.ai/docs/getting-started/buying-units-programmatically) [NextOnboarding Guideschevron-right](https://thegrid.ai/docs/onboarding-guides) Last updated 4 days ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Buying Units Programmatically | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good evening I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send Start interacting with our Trading API to buy units programmatically using the following steps. [hashtag](https://thegrid.ai/docs/getting-started/buying-units-programmatically#send-your-first-trading-api-request) Send your first Trading API request ------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 ### [hashtag](https://thegrid.ai/docs/getting-started/buying-units-programmatically#generate-a-key-pair) Generate a Key Pair Python JavaScript Go Copy from nacl.signing import SigningKey import base64 private_key = SigningKey.generate() public_key = private_key.verify_key private_key_b64 = base64.b64encode(bytes(private_key)).decode() public_key_b64 = base64.b64encode(bytes(public_key)).decode() print(f'Private Key: {private_key_b64}') print(f'Public Key: {public_key_b64}') Copy import nacl from 'tweetnacl'; import util from 'tweetnacl-util'; const keyPair = nacl.sign.keyPair(); const privateKey = util.encodeBase64(keyPair.secretKey); const publicKey = util.encodeBase64(keyPair.publicKey); console.log('Private Key:', privateKey); console.log('Public Key:', publicKey); 2 ### [hashtag](https://thegrid.ai/docs/getting-started/buying-units-programmatically#register-the-public-key) Register the Public Key Open your app and head to [API Keysarrow-up-right](https://app.thegrid.ai/api-keys) . Follow the following steps to register your API key and obtain a fingerprint for that key. \[Insert Product Screenshots\] 3 ### [hashtag](https://thegrid.ai/docs/getting-started/buying-units-programmatically#choose-an-instrument-and-send-a-buy-order) Choose an instrument, and send a buy order Use the fingerprint in the following script to Market or Limit Buy 1 Unit of your chosen Instrument (Chat Fast or Chat Prime). * **Chat Fast**: suited for latency-sensitive UX, high throughput, instantaneous responses * **Chat Prime**: suited for higher reasoning quality, thoughtful or calculative responses, deeper workflows Read more about [Current Instruments](https://thegrid.ai/docs/instruments-and-specifications/current-instruments-chat-prime-and-chat-fast) to guide your decision. Python JavaScript Go Copy import base64 import json import os import time import requests from nacl.signing import SigningKey BASE_URL = "https://trading.api.thegrid.ai" class SignatureAuth: def __init__(self, private_key_b64, fingerprint): self.private_key = SigningKey(base64.b64decode(private_key_b64)[:32]) self.fingerprint = fingerprint def get_headers(self, method, path, body=""): timestamp = str(int(time.time())) message = f"{timestamp}{method.upper()}{path}{body}" signature = self.private_key.sign(message.encode()).signature return { "x-thegrid-signature": base64.b64encode(signature).decode(), "x-thegrid-timestamp": timestamp, "x-thegrid-fingerprint": self.fingerprint, } auth = SignatureAuth( os.environ["GRID_TRADING_PRIVATE_KEY"], os.environ["GRID_TRADING_FINGERPRINT"], ) order_data = { "market_id": "market_788dcbd5-ac68-4c61-acf1-4443beaf2a1c", "side": "buy", "type": "limit", "quantity": 1, "price": "2.50", "time_in_force": "gtc", "client_order_id": f"buy-{int(time.time())}", } path = "/api/v1/trading/orders" body = json.dumps(order_data) headers = auth.get_headers("POST", path, body) headers["Content-Type"] = "application/json" response = requests.post(f"{BASE_URL}{path}", data=body, headers=headers) response.raise_for_status() print("Order ID:", response.json()["data"]["order_id"]) 4 ### [hashtag](https://thegrid.ai/docs/getting-started/buying-units-programmatically#see-the-unit-transferred-to-your-consumption-account) See the Unit transferred to your Consumption Account **Note:** Today, Units bought in your Trading Account transfer to your Consumption Account [automatically](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts) . You can use this script to check the Units that have been transferred to your Consumption account and are active. Python JavaScript Go Copy import base64 import os import time import requests from nacl.signing import SigningKey BASE_URL = "https://trading.api.thegrid.ai" class SignatureAuth: def __init__(self, private_key_b64, fingerprint): self.private_key = SigningKey(base64.b64decode(private_key_b64)[:32]) self.fingerprint = fingerprint def get_headers(self, method, path, body=""): timestamp = str(int(time.time())) message = f"{timestamp}{method.upper()}{path}{body}" signature = self.private_key.sign(message.encode()).signature return { "x-thegrid-signature": base64.b64encode(signature).decode(), "x-thegrid-timestamp": timestamp, "x-thegrid-fingerprint": self.fingerprint, } auth = SignatureAuth( os.environ["GRID_TRADING_PRIVATE_KEY"], os.environ["GRID_TRADING_FINGERPRINT"], ) # Consumption accounts consumption_path = "/api/v1/trading/consumption-accounts" consumption_resp = requests.get( f"{BASE_URL}{consumption_path}?order_by=created_at", headers=auth.get_headers("GET", consumption_path), ) consumption_resp.raise_for_status() print("=== Consumption Accounts ===") for acct in consumption_resp.json()["data"]: print( f"{acct['account_id']}: {acct['available_balance']} available, {acct['total_balance']} total (instrument {acct['instrument_id']})" ) 5 * Use our [Onboarding Guides](https://thegrid.ai/docs/onboarding-guides) for ready-to-go scripts to automate your buying and inference consumption on The Grid. These scripts cover common use cases for production implementation. * To ensure performant and efficient service, follow our [Best Practices](https://thegrid.ai/docs/onboarding-guides/best-practices) for moving your workloads from other inference providers/aggregators to The Grid [PreviousGetting started as a Consumerchevron-left](https://thegrid.ai/docs/getting-started/getting-started-as-a-consumer) [NextSupplying to The Gridchevron-right](https://thegrid.ai/docs/getting-started/supplying-to-the-grid) Last updated 1 day ago Was this helpful? * [Send your first Trading API request](https://thegrid.ai/docs/getting-started/buying-units-programmatically#send-your-first-trading-api-request) * [Generate a Key Pair](https://thegrid.ai/docs/getting-started/buying-units-programmatically#generate-a-key-pair) * [Register the Public Key](https://thegrid.ai/docs/getting-started/buying-units-programmatically#register-the-public-key) * [Choose an instrument, and send a buy order](https://thegrid.ai/docs/getting-started/buying-units-programmatically#choose-an-instrument-and-send-a-buy-order) * [See the Unit transferred to your Consumption Account](https://thegrid.ai/docs/getting-started/buying-units-programmatically#see-the-unit-transferred-to-your-consumption-account) Was this helpful? sun-brightdesktopmoon Copy package main import ( "crypto/ed25519" "crypto/rand" "encoding/base64" "fmt" ) func main() { publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader) if err != nil { panic(err) } privateKeyB64 := base64.StdEncoding.EncodeToString(privateKey.Seed()) publicKeyB64 := base64.StdEncoding.EncodeToString(publicKey) fmt.Println("Private Key:", privateKeyB64) fmt.Println("Public Key:", publicKeyB64) fmt.Println("Register this public key via the app or API.") } Copy // Buy Instrument Unit (Trading API) import axios from 'axios'; import nacl from 'tweetnacl'; import util from 'tweetnacl-util'; function decodePrivateKey(privateKeyBase64) { const raw = util.decodeBase64(privateKeyBase64); if (raw.length === nacl.sign.seedLength) { return nacl.sign.keyPair.fromSeed(raw).secretKey; } if (raw.length === nacl.sign.secretKeyLength) { return raw; } throw new Error('Invalid private key length; expected 32-byte seed or 64-byte secret key'); } const BASE_URL = 'https://trading.api.thegrid.ai'; class SignatureAuth { constructor(privateKeyBase64, fingerprint) { this.privateKey = decodePrivateKey(privateKeyBase64); this.fingerprint = fingerprint; } getHeaders(method, path, body = '') { const timestamp = Math.floor(Date.now() / 1000).toString(); const message = `${timestamp}${method.toUpperCase()}${path}${body}`; const messageBytes = util.decodeUTF8(message); const signatureBytes = nacl.sign.detached(messageBytes, this.privateKey); return { 'x-thegrid-signature': util.encodeBase64(signatureBytes), 'x-thegrid-timestamp': timestamp, 'x-thegrid-fingerprint': this.fingerprint }; } } const auth = new SignatureAuth( process.env.GRID_TRADING_PRIVATE_KEY, process.env.GRID_TRADING_FINGERPRINT ); const orderData = { market_id: 'market_788dcbd5-ac68-4c61-acf1-4443beaf2a1c', side: 'buy', type: 'limit', quantity: 1, price: '2.50', time_in_force: 'gtc', client_order_id: `buy-${Date.now()}` }; const path = '/api/v1/trading/orders'; const body = JSON.stringify(orderData); const response = await axios.post(`${BASE_URL}${path}`, body, { headers: { 'Content-Type': 'application/json', ...auth.getHeaders('POST', path, body) } }); console.log('Order ID:', response.data.data.order_id); Copy package main import ( "bytes" "crypto/ed25519" "encoding/base64" "encoding/json" "fmt" "log" "net/http" "os" "strconv" "time" ) const baseURL = "https://trading.api.thegrid.ai" type SignatureAuth struct { privateKey ed25519.PrivateKey fingerprint string } func NewSignatureAuth(privateKeyB64, fingerprint string) *SignatureAuth { privateKeyBytes, _ := base64.StdEncoding.DecodeString(privateKeyB64) var privateKey ed25519.PrivateKey if len(privateKeyBytes) == ed25519.SeedSize { privateKey = ed25519.NewKeyFromSeed(privateKeyBytes) } else { privateKey = ed25519.PrivateKey(privateKeyBytes) } return &SignatureAuth{privateKey: privateKey, fingerprint: fingerprint} } func (sa *SignatureAuth) GetHeaders(method, path, body string) map[string]string { timestamp := strconv.FormatInt(time.Now().Unix(), 10) message := timestamp + method + path + body signature := ed25519.Sign(sa.privateKey, []byte(message)) return map[string]string{ "x-thegrid-signature": base64.StdEncoding.EncodeToString(signature), "x-thegrid-timestamp": timestamp, "x-thegrid-fingerprint": sa.fingerprint, } } func main() { auth := NewSignatureAuth( os.Getenv("GRID_TRADING_PRIVATE_KEY"), os.Getenv("GRID_TRADING_FINGERPRINT"), ) orderData := map[string]any{ "market_id": "market_788dcbd5-ac68-4c61-acf1-4443beaf2a1c", "side": "buy", "type": "limit", "quantity": 1, "price": "2.50", "time_in_force": "gtc", "client_order_id": fmt.Sprintf("buy-%d", time.Now().Unix()), } orderJSON, err := json.Marshal(orderData) if err != nil { log.Fatal(err) } path := "/api/v1/trading/orders" req, err := http.NewRequest("POST", baseURL+path, bytes.NewBuffer(orderJSON)) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") for k, v := range auth.GetHeaders("POST", path, string(orderJSON)) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() var result struct { Data struct { OrderID string `json:"order_id"` } `json:"data"` } if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { log.Fatal(err) } fmt.Println("Order ID:", result.Data.OrderID) } Copy import axios from 'axios'; import nacl from 'tweetnacl'; import util from 'tweetnacl-util'; function decodePrivateKey(privateKeyBase64) { const raw = util.decodeBase64(privateKeyBase64); if (raw.length === nacl.sign.seedLength) { return nacl.sign.keyPair.fromSeed(raw).secretKey; } if (raw.length === nacl.sign.secretKeyLength) { return raw; } throw new Error('Invalid private key length; expected 32-byte seed or 64-byte secret key'); } const BASE_URL = 'https://trading.api.thegrid.ai'; class SignatureAuth { constructor(privateKeyBase64, fingerprint) { this.privateKey = decodePrivateKey(privateKeyBase64); this.fingerprint = fingerprint; } getHeaders(method, path, body = '') { const timestamp = Math.floor(Date.now() / 1000).toString(); const message = `${timestamp}${method.toUpperCase()}${path}${body}`; const messageBytes = util.decodeUTF8(message); const signatureBytes = nacl.sign.detached(messageBytes, this.privateKey); return { 'x-thegrid-signature': util.encodeBase64(signatureBytes), 'x-thegrid-timestamp': timestamp, 'x-thegrid-fingerprint': this.fingerprint }; } } const auth = new SignatureAuth( process.env.GRID_TRADING_PRIVATE_KEY, process.env.GRID_TRADING_FINGERPRINT ); // Consumption accounts const consumptionPath = '/api/v1/trading/consumption-accounts'; const consumptionResp = await axios.get(`${BASE_URL}${consumptionPath}?order_by=created_at`, { headers: auth.getHeaders('GET', consumptionPath) }); console.log('=== Consumption Accounts ==='); for (const acct of consumptionResp.data.data) { console.log(`${acct.account_id}: ${acct.available_balance} available, ${acct.total_balance} total (instrument ${acct.instrument_id})`); } Copy package main import ( "crypto/ed25519" "encoding/base64" "encoding/json" "fmt" "log" "net/http" "os" "strconv" "time" ) const baseURL = "https://trading.api.thegrid.ai" type SignatureAuth struct { privateKey ed25519.PrivateKey fingerprint string } func NewSignatureAuth(privateKeyB64, fingerprint string) *SignatureAuth { privateKeyBytes, _ := base64.StdEncoding.DecodeString(privateKeyB64) var privateKey ed25519.PrivateKey if len(privateKeyBytes) == ed25519.SeedSize { privateKey = ed25519.NewKeyFromSeed(privateKeyBytes) } else { privateKey = ed25519.PrivateKey(privateKeyBytes) } return &SignatureAuth{privateKey: privateKey, fingerprint: fingerprint} } func (sa *SignatureAuth) GetHeaders(method, path, body string) map[string]string { timestamp := strconv.FormatInt(time.Now().Unix(), 10) message := timestamp + method + path + body signature := ed25519.Sign(sa.privateKey, []byte(message)) return map[string]string{ "x-thegrid-signature": base64.StdEncoding.EncodeToString(signature), "x-thegrid-timestamp": timestamp, "x-thegrid-fingerprint": sa.fingerprint, } } func main() { auth := NewSignatureAuth( os.Getenv("GRID_TRADING_PRIVATE_KEY"), os.Getenv("GRID_TRADING_FINGERPRINT"), ) // Consumption accounts consumptionPath := "/api/v1/trading/consumption-accounts" req0, err := http.NewRequest("GET", baseURL+consumptionPath+"?order_by=created_at", nil) if err != nil { log.Fatal(err) } for k, v := range auth.GetHeaders("GET", consumptionPath, "") { req0.Header.Set(k, v) } resp0, err := http.DefaultClient.Do(req0) if err != nil { log.Fatal(err) } defer resp0.Body.Close() var consumptionResult struct { Data []struct { AccountID string `json:"account_id"` InstrumentID string `json:"instrument_id"` AvailableBalance json.Number `json:"available_balance"` TotalBalance json.Number `json:"total_balance"` } `json:"data"` } if err := json.NewDecoder(resp0.Body).Decode(&consumptionResult); err != nil { log.Fatal(err) } fmt.Println("=== Consumption Accounts ===") for _, acct := range consumptionResult.Data { fmt.Printf("%s: %s available, %s total (instrument %s)\n", acct.AccountID, acct.AvailableBalance.String(), acct.TotalBalance.String(), acct.InstrumentID) } } sun-brightdesktopmoon --- # Trading and Consumption Accounts | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts#overview) Overview The Grid separates ownership from active usage by giving each participant two logical balances per Instrument. * **Trading Account** A holding account for purchased Units. Units here: * Can be resold on the order book, where buyers can take advantage of price trends and differences to lower their cost of ownership * Can be swept into the Consumption Account every 4 hours. Scheduled Sweeps occur every day at 00:00, 04:00, 08:00, 12:00, 16:00, 20:00 UTC automatically\*. * Are eligible to be swept into Consumption on a fixed schedule. * **Consumption Account** A bucket for Units that are ready to be used via the API. Units here: * Are locked for usage only and cannot be resold. * Are grouped into Lots, each with a 4 hour consumption window. * Are depleted as your applications run. ### [hashtag](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts#the-relationship-between-accounts) The relationship between accounts In a broader sense, you can think of this as: * Trading Account = inference supply that can still move around the market. * Consumption Account = committed demand for consumption circle-info \*Scheduled Sweeps from Trading to Consumption Account are coming soon. Currently, all units are transferred to the Consumption Account as soon as the trade is filled. [PreviousUnitschevron-left](https://thegrid.ai/docs/core-concepts/units) [NextLots and Consumption Windowchevron-right](https://thegrid.ai/docs/core-concepts/lots-and-consumption-window) Was this helpful? * [Overview](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts#overview) * [The relationship between accounts](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts#the-relationship-between-accounts) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Working with Trading and Consumption Balances | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good evening I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send Use these scripts to Query the balances in your Accounts: 1. Credit Balance: Balance in your Trading Account which can be used for buying Units 2. Instruments in Trading Account: These are Units you have purchased and can be transferred to Consumption Account 3. Instruments active in Consumption: These are units which are already transferred in your Consumption Account, and must be used as per [Consumption Rules](https://thegrid.ai/docs/consumption-delivery-and-metering) . circle-info Currently, Units bought in the Trading Account are automatically transffered to the Consumption Account. Python JavaScript Go [PreviousOnboarding Guideschevron-left](https://thegrid.ai/docs/onboarding-guides) [NextReplenishing Consumption Account Balancechevron-right](https://thegrid.ai/docs/onboarding-guides/replenishing-consumption-account-balance) Last updated 1 day ago Was this helpful? Was this helpful? sun-brightdesktopmoon Copy import base64 import os import time import requests from nacl.signing import SigningKey BASE_URL = 'https://trading.api.thegrid.ai' class SignatureAuth: def __init__(self, private_key_b64, fingerprint): self.private_key = SigningKey(base64.b64decode(private_key_b64)[:32]) self.fingerprint = fingerprint def get_headers(self, method, path, body=''): timestamp = str(int(time.time())) message = f'{timestamp}{method.upper()}{path}{body}' signature = self.private_key.sign(message.encode()).signature return { 'x-thegrid-signature': base64.b64encode(signature).decode(), 'x-thegrid-timestamp': timestamp, 'x-thegrid-fingerprint': self.fingerprint, } auth = SignatureAuth( os.environ['GRID_TRADING_PRIVATE_KEY'], os.environ['GRID_TRADING_FINGERPRINT'], ) # Consumption accounts consumption_path = '/api/v1/trading/consumption-accounts' consumption_resp = requests.get(f'{BASE_URL}{consumption_path}?order_by=created_at', headers=auth.get_headers('GET', consumption_path)) consumption_resp.raise_for_status() print('=== Consumption Accounts ===') for acct in consumption_resp.json()['data']: print(f"{acct['account_id']}: {acct['available_balance']} available, {acct['total_balance']} total (instrument {acct['instrument_id']})") # Currency balance (USD) currency_path = '/api/v1/trading/currency-trading-accounts' currency_resp = requests.get(f'{BASE_URL}{currency_path}', headers=auth.get_headers('GET', currency_path)) currency_resp.raise_for_status() print('=== Currency Balance ===') for acct in currency_resp.json()['data']: print(f"{acct['currency'].upper()}: ${acct['available_balance']} available, ${acct['total_balance']} total") # Trading accounts (instruments) trading_path = '/api/v1/trading/trading-accounts' trading_resp = requests.get(f'{BASE_URL}{trading_path}', headers=auth.get_headers('GET', trading_path)) trading_resp.raise_for_status() print('\n=== Trading Accounts ===') for acct in trading_resp.json()['data']: print(f"{acct['instrument_symbol']}: {acct['available_balance']} available, {acct['total_balance']} total") chevron-downShow all 58 lines Copy // View Account Balances (Trading API) import axios from 'axios'; import nacl from 'tweetnacl'; import util from 'tweetnacl-util'; function decodePrivateKey(privateKeyBase64) { const raw = util.decodeBase64(privateKeyBase64); if (raw.length === nacl.sign.seedLength) { return nacl.sign.keyPair.fromSeed(raw).secretKey; } if (raw.length === nacl.sign.secretKeyLength) { return raw; } throw new Error('Invalid private key length; expected 32-byte seed or 64-byte secret key'); } const BASE_URL = 'https://trading.api.thegrid.ai'; class SignatureAuth { constructor(privateKeyBase64, fingerprint) { this.privateKey = decodePrivateKey(privateKeyBase64); this.fingerprint = fingerprint; } getHeaders(method, path, body = '') { const timestamp = Math.floor(Date.now() / 1000).toString(); const message = `${timestamp}${method.toUpperCase()}${path}${body}`; const messageBytes = util.decodeUTF8(message); const signatureBytes = nacl.sign.detached(messageBytes, this.privateKey); return { 'x-thegrid-signature': util.encodeBase64(signatureBytes), 'x-thegrid-timestamp': timestamp, 'x-thegrid-fingerprint': this.fingerprint }; } } const auth = new SignatureAuth( process.env.GRID_TRADING_PRIVATE_KEY, process.env.GRID_TRADING_FINGERPRINT ); // Consumption accounts const consumptionPath = '/api/v1/trading/consumption-accounts'; const consumptionResp = await axios.get(`${BASE_URL}${consumptionPath}?order_by=created_at`, { headers: auth.getHeaders('GET', consumptionPath) }); console.log('=== Consumption Accounts ==='); for (const acct of consumptionResp.data.data) { console.log(`${acct.account_id}: ${acct.available_balance} available, ${acct.total_balance} total (instrument ${acct.instrument_id})`); } // Currency balance (USD) const currencyPath = '/api/v1/trading/currency-trading-accounts'; const currencyResp = await axios.get(`${BASE_URL}${currencyPath}`, { headers: auth.getHeaders('GET', currencyPath) }); console.log('=== Currency Balance ==='); for (const acct of currencyResp.data.data) { console.log(`${acct.currency.toUpperCase()}: $${acct.available_balance} available, $${acct.total_balance} total`); } // Trading accounts (instruments) const tradingPath = '/api/v1/trading/trading-accounts'; const tradingResp = await axios.get(`${BASE_URL}${tradingPath}`, { headers: auth.getHeaders('GET', tradingPath) }); console.log('\n=== Trading Accounts ==='); for (const acct of tradingResp.data.data) { console.log(`${acct.instrument_symbol}: ${acct.available_balance} available, ${acct.total_balance} total`); } Copy package main import ( "crypto/ed25519" "encoding/base64" "encoding/json" "fmt" "log" "net/http" "os" "strconv" "strings" "time" ) const baseURL = "https://trading.api.thegrid.ai" type SignatureAuth struct { privateKey ed25519.PrivateKey fingerprint string } func NewSignatureAuth(privateKeyB64, fingerprint string) *SignatureAuth { privateKeyBytes, _ := base64.StdEncoding.DecodeString(privateKeyB64) var privateKey ed25519.PrivateKey if len(privateKeyBytes) == ed25519.SeedSize { privateKey = ed25519.NewKeyFromSeed(privateKeyBytes) } else { privateKey = ed25519.PrivateKey(privateKeyBytes) } return &SignatureAuth{privateKey: privateKey, fingerprint: fingerprint} } func (sa *SignatureAuth) GetHeaders(method, path, body string) map[string]string { timestamp := strconv.FormatInt(time.Now().Unix(), 10) message := timestamp + method + path + body signature := ed25519.Sign(sa.privateKey, []byte(message)) return map[string]string{ "x-thegrid-signature": base64.StdEncoding.EncodeToString(signature), "x-thegrid-timestamp": timestamp, "x-thegrid-fingerprint": sa.fingerprint, } } func main() { auth := NewSignatureAuth( os.Getenv("GRID_TRADING_PRIVATE_KEY"), os.Getenv("GRID_TRADING_FINGERPRINT"), ) // Consumption accounts consumptionPath := "/api/v1/trading/consumption-accounts" req0, err := http.NewRequest("GET", baseURL+consumptionPath+"?order_by=created_at", nil) if err != nil { log.Fatal(err) } for k, v := range auth.GetHeaders("GET", consumptionPath, "") { req0.Header.Set(k, v) } resp0, err := http.DefaultClient.Do(req0) if err != nil { log.Fatal(err) } defer resp0.Body.Close() var consumptionResult struct { Data []struct { AccountID string `json:"account_id"` InstrumentID string `json:"instrument_id"` AvailableBalance json.Number `json:"available_balance"` TotalBalance json.Number `json:"total_balance"` } `json:"data"` } if err := json.NewDecoder(resp0.Body).Decode(&consumptionResult); err != nil { log.Fatal(err) } fmt.Println("=== Consumption Accounts ===") for _, acct := range consumptionResult.Data { fmt.Printf("%s: %s available, %s total (instrument %s)\n", acct.AccountID, acct.AvailableBalance.String(), acct.TotalBalance.String(), acct.InstrumentID) } // Currency balance (USD) currencyPath := "/api/v1/trading/currency-trading-accounts" req, err := http.NewRequest("GET", baseURL+currencyPath, nil) if err != nil { log.Fatal(err) } for k, v := range auth.GetHeaders("GET", currencyPath, "") { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() var currencyResult struct { Data []struct { Currency string `json:"currency"` AvailableBalance string `json:"available_balance"` TotalBalance string `json:"total_balance"` } `json:"data"` } if err := json.NewDecoder(resp.Body).Decode(¤cyResult); err != nil { log.Fatal(err) } fmt.Println("=== Currency Balance ===") for _, acct := range currencyResult.Data { fmt.Printf("%s: $%s available, $%s total\n", strings.ToUpper(acct.Currency), acct.AvailableBalance, acct.TotalBalance) } // Trading accounts (instruments) tradingPath := "/api/v1/trading/trading-accounts" req2, err := http.NewRequest("GET", baseURL+tradingPath, nil) if err != nil { log.Fatal(err) } for k, v := range auth.GetHeaders("GET", tradingPath, "") { req2.Header.Set(k, v) } resp2, err := http.DefaultClient.Do(req2) if err != nil { log.Fatal(err) } defer resp2.Body.Close() var tradingResult struct { Data []struct { InstrumentSymbol string `json:"instrument_symbol"` AvailableBalance string `json:"available_balance"` TotalBalance string `json:"total_balance"` } `json:"data"` } if err := json.NewDecoder(resp2.Body).Decode(&tradingResult); err != nil { log.Fatal(err) } fmt.Println("\n=== Trading Accounts ===") for _, acct := range tradingResult.Data { fmt.Printf("%s: %s available, %s total\n", acct.InstrumentSymbol, acct.AvailableBalance, acct.TotalBalance) } } sun-brightdesktopmoon --- # Tokens and Metering | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/core-concepts/tokens-and-metering#how-tokens-are-tracked) How tokens are tracked Internally, The Grid uses a canonical metering system to track how many tokens each API call consumed and how that maps to your Units: * For every call, the platform counts input and output tokens using metering components that are specific to categories of models. * It subtracts the tokens from the oldest Lot (i.e. the lot that is closest to expiration) in your Consumption Account. * It records the mapping between the call, the Lot and the Unit to consume from, the trade that funded it, and the supplier that served it. You can read more about our metering system [here](https://thegrid.ai/docs/consumption-delivery-and-metering) . [PreviousScheduled Sweepschevron-left](https://thegrid.ai/docs/core-concepts/scheduled-sweeps) [NextMarket Participantschevron-right](https://thegrid.ai/docs/core-concepts/market-participants) Last updated 1 month ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Instruments | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/core-concepts/instruments#what-is-an-instrument) What is an Instrument? An **Instrument** is a standardized contract that gives the buyer the right to consume inference and gives the seller the obligation to deliver it, from any model that meets or exceeds a defined minimum service level benchmark. Each Instrument is governed by a **Specification**. It is a bundle of thresholds that all conforming models must meet, such as: * Performance score on [Artificial Analysis Intelligence Indexarrow-up-right](https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index) . * Throughput in tokens per second. * Time to first token. * Context window size. * Maximum output length. As long as a supplier model meets or exceeds the thresholds for an Instrument, they can deliver that Instrument. We manage our suppliers and monitor their performance to ensure that all suppliers meet these specifications. ### [hashtag](https://thegrid.ai/docs/core-concepts/instruments#current-instruments) Current Instruments Today The Grid focuses on text to text Instruments, such as: * **Chat Fast**: for low latency and high throughput * **Chat Prime**: for higher reasoning quality and long outputs [Read more about our Current Instruments and Specifications here.](https://thegrid.ai/docs/instruments-and-specifications/instrument-specifications-as-of-jan-2026) circle-info Several more Instruments are on the near term roadmap as the platform scales. If you have suggestions or feedback on the Instruments we should support, please contact [\[email protected\]](https://thegrid.ai/cdn-cgi/l/email-protection) [PreviousCore Conceptschevron-left](https://thegrid.ai/docs/core-concepts) [NextUnitschevron-right](https://thegrid.ai/docs/core-concepts/units) Last updated 1 month ago Was this helpful? * [What is an Instrument?](https://thegrid.ai/docs/core-concepts/instruments#what-is-an-instrument) * [Current Instruments](https://thegrid.ai/docs/core-concepts/instruments#current-instruments) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Evolution of Specifications | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send #### [hashtag](https://thegrid.ai/docs/instruments-and-specifications/evolution-of-specifications#keeping-pace-with-ai-progress) Keeping pace with AI progress The AI landscape moves quickly. To keep Instruments relevant: * Specifications and their thresholds are periodically updated to reflect new model capabilities and track the expanding frontier of model intelligence. * The Grid works with Suppliers to ensure that they maintain service level performance, and always serve the models that efficiently meet the specification. * New Instruments can be introduced for specific use cases, modalities, or regional requirements, such as code focused Instruments or regional privacy constraints. The Grid periodically updates its actual Contract with Suppliers to ensure that Suppliers continue to deliver inference to buyers that meets the Instrument Specifications. [PreviousInstrument Specifications (as of Jan 2026)chevron-left](https://thegrid.ai/docs/instruments-and-specifications/instrument-specifications-as-of-jan-2026) [NextMarket Mechanicschevron-right](https://thegrid.ai/docs/market-mechanics) Last updated 1 month ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Lifecycle of a Unit | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/market-mechanics/lifecycle-of-a-unit#from-issuance-to-consumption) From issuance to consumption From a market perspective, each Unit goes through a simple life cycle: * **Issued** A supplier or Capacity Aggregator lists Units at one or more price levels. * **Traded** A buyer order matches these Units. Ownership of the Units moves from the supplier Trading Account to the buyer Trading Account. Buyer can start consuming inference instantly by transfering this unit from their Trading to Consumption Account. * **Tradable Window** The Unit can now be resold on the CLOB until the next Scheduled Sweep\*. * **Swept to Consumption** At the next Sweep event, all Units remaining in the buyer Trading Account for that Instrument are force transferred into the buyer Consumption Account as Lots. * **Consumed or Expired** The buyer applications use those Lots via the API during their 4 hour consumption window. Any leftover tokens at the end of that window expire. circle-info \*Scheduled Sweeps from Trading to Consumption Account are coming soon. Currently, all units are transferred to the Consumption Account as soon as the trade is filled. ### [hashtag](https://thegrid.ai/docs/market-mechanics/lifecycle-of-a-unit#why-this-matters) Why this matters This flow ensures that every Unit is either used or expired within a bounded horizon, which is critical for inference as a non storable commodity. [PreviousOrder Typeschevron-left](https://thegrid.ai/docs/market-mechanics/order-types) [NextDesign Advantageschevron-right](https://thegrid.ai/docs/market-mechanics/design-advantages) Last updated 1 month ago Was this helpful? * [From issuance to consumption](https://thegrid.ai/docs/market-mechanics/lifecycle-of-a-unit#from-issuance-to-consumption) * [Why this matters](https://thegrid.ai/docs/market-mechanics/lifecycle-of-a-unit#why-this-matters) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Design Advantages | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send #### [hashtag](https://thegrid.ai/docs/market-mechanics/design-advantages#advantages-of-the-clob--scheduled-sweep-model) Advantages of the CLOB + Scheduled Sweep model The CLOB + Scheduled Sweep design was chosen because it offers several advantages: * **Simplified Adoption** It uses a familiar continuous order book that traders across financial markets (stocks, crypto, etc.) already understand. There is no need to teach everyone new auction formats before they can trade. * **Clear Capacity Signal** Allowing resale between purchase and Sweep lets the market reveal how participants value time until consumption. Suppliers can adjust prices intraday based on real time capacity, and buyers can adjust based on their ability to use Units before Sweeps. * **Use It or Lose It Instead of Subscription Fees** Instead of punishing holders with subscription fees or minimum commitments, this open market design with forced, time bound consumption drives aggressive pricing towards a definite predictable demand, thus making the market convenient and efficient for both buyers and sellers. ### [hashtag](https://thegrid.ai/docs/market-mechanics/design-advantages#comparison-to-status-quo) Comparison to Status Quo #### [hashtag](https://thegrid.ai/docs/market-mechanics/design-advantages#how-the-grid-is-different) How The Grid is different Buying inference today usually means: * Evaluating model benchmarks and suppliers on their service performance, followed by internal procurement * Accepting opaque rate limits and throttling. * Negotiating custom discounts and contracts. * Juggling multiple SDKs and pricing tables. #### [hashtag](https://thegrid.ai/docs/market-mechanics/design-advantages#what-the-grid-offers-instead) What The Grid offers instead The Grid replaces that with: * **Transparent Pricing** Everyone sees the same bids, asks, spreads, and depth for each Instrument in real time. * **Active Capacity Instead of Idle Credits** The 4 hour consumption window converts purchased Units into near term usage. Suppliers can price idle capacity more tightly because they know it will resolve quickly. * **Open Competition** Any conforming model can fulfill an Instrument. Better models can undercut worse ones while buyers keep a single integration. * **Enforced Standards** Each call is measured against Instrument benchmarks. Failed or late delivery is not billed, and suppliers that drift are corrected or removed. #### [hashtag](https://thegrid.ai/docs/market-mechanics/design-advantages#the-result) The result The result is a market that is clearer, cheaper, and fairer for both sides. [PreviousLifecycle of a Unitchevron-left](https://thegrid.ai/docs/market-mechanics/lifecycle-of-a-unit) [NextConsumption, Delivery and Meteringchevron-right](https://thegrid.ai/docs/consumption-delivery-and-metering) Last updated 1 month ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Central Limit Order Book (CLOB) and Scheduled Sweeps | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send circle-info \*Scheduled Sweeps from Trading to Consumption Account are coming soon. Currently, all units are transferred to the Consumption Account as soon as the trade is filled. ### [hashtag](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#how-the-order-book-works) How the order book works At a high level, The Grid runs a real time CLOB with periodic sweeps from Trading to Consumption Accounts. For each Instrument, the exchange maintains a live order book: * **Limit Buy (Bid):** They specify a maximum price per Unit and a quantity of Units. * A **Markey Buy (Bid)** is automatically submitted at the highest bid price. * **Limit Sell (Ask):** They specify a minimum price per Unit and a quantity of Units. * A **Market Sell (Ask)** is automatically submitted at the lowest ask price. * The **highest bid** and **lowest ask** at any moment form the inside market. #### [hashtag](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#matching-rules) Matching rules The matching engine follows standard price time priority: 1. Orders are sorted first by price. **Better prices match first**. 2. Within the same price level, **earlier orders match before later ones.** Orders can match against multiple counterparties. One buyer can be serviced by many suppliers and one supplier might sell to many buyers. ### [hashtag](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#scheduled-sweeps) Scheduled Sweeps\* The Scheduled Sweeps work in conjunction with the CLOB as follows: * Trading Accounts hold financially owned Units. * Consumption Accounts hold Units that must be used via the API. * A Sweep event every 4 hours (00:00, 04:00 UTC, and so on) transfers Units from Trading to Consumption Account, closing the loop between trading and delivery. #### [hashtag](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#key-properties) Key properties * **No Resale from Consumption** Once a Unit is in the Consumption Account, it cannot be resold. It must either be used or expire. * **Resale Only Before Sweep** Units can be freely resold while they are in Trading Account. Buyers have until the next sweep to re-sell their unit if their consumption plans change. * **Time Value of Units** A Unit bought right after a Sweep has nearly 4 hours of price-time curve that professional participants can use to trade and arbitrage. [PreviousMarket Mechanicschevron-left](https://thegrid.ai/docs/market-mechanics) [NextOrder Typeschevron-right](https://thegrid.ai/docs/market-mechanics/order-types) Last updated 1 month ago Was this helpful? * [How the order book works](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#how-the-order-book-works) * [Scheduled Sweeps\*](https://thegrid.ai/docs/market-mechanics/central-limit-order-book-clob-and-scheduled-sweeps#scheduled-sweeps) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Lots and Consumption Window | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/core-concepts/lots-and-consumption-window#what-are-lots) What are Lots? When Units leave your Trading Account, either through a [Scheduled Sweep](https://thegrid.ai/docs/core-concepts/scheduled-sweeps) or a voluntary transfer, they are grouped into **Lots** in your Consumption Account. Each Lot: * Represents a **specific quantity** of Units. * Has a fixed **4 hour expiry**. * Is consumed on a **first in, first out (FIFO)** basis. The system always spends from the Lot that expires soonest. ### [hashtag](https://thegrid.ai/docs/core-concepts/lots-and-consumption-window#why-4-hours) Why 4 hours? The 4 hour window is a deliberate design choice: * It gives suppliers strong certainty that any Units they sell will either be used quickly or expire, which lets them price more aggressively and predictably. * It is long enough to cover typical interactive usage and near term batch jobs, including workloads scheduled around predictable troughs. If a Lot reaches the end of its 4 hour window with leftover tokens, those tokens expire and are no longer usable or refundable. This use it or lose it rule is a core part of the market discipline. [PreviousTrading and Consumption Accountschevron-left](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts) [NextScheduled Sweepschevron-right](https://thegrid.ai/docs/core-concepts/scheduled-sweeps) Last updated 1 month ago Was this helpful? * [What are Lots?](https://thegrid.ai/docs/core-concepts/lots-and-consumption-window#what-are-lots) * [Why 4 hours?](https://thegrid.ai/docs/core-concepts/lots-and-consumption-window#why-4-hours) Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon --- # Units | The Grid GitBook Assistant GitBook Assistant Working...Thinking... close GitBook Assistant ##### Good afternoon I'm here to help you with the docs. What is this page about?What should I read next?Can you give an example? chevron-upchevron-down Ctrli AI Based on your contextquestion-circle Send ### [hashtag](https://thegrid.ai/docs/core-concepts/units#what-is-a-unit) What is a Unit? A **Unit** is the atomic quantity of an Instrument. * One Unit represents **1 million tokens** of inference capacity. Input and output tokens are counted as the same. * The price of the Instrument on the exchange is the price of **1 Unit**, or 1M tokens. Units are bought or sold in integer quantities, no sub-units. * Units are what you buy on the exchange, what you see in your balances, and what your applications spend tokens from when they call the API. This makes Units comparable to barrels of oil or megawatt hours of electricity. They are standardized buckets of fuel for consumption. [PreviousInstrumentschevron-left](https://thegrid.ai/docs/core-concepts/instruments) [NextTrading and Consumption Accountschevron-right](https://thegrid.ai/docs/core-concepts/trading-and-consumption-accounts) Last updated 1 month ago Was this helpful? Was this helpful? sun-brightdesktopmoon sun-brightdesktopmoon ---