Model ID: x-ai/grok-code-fast-1
per 1M tokens
per 1M tokens
per 1M tokens
import requests
# Fetch pricing data from llmprices.ai
response = requests.get(
"https://llmprices.ai/api/pricing?model=x-ai/grok-code-fast-1"
)
data = response.json()
print(f"Model: {data['name']}")
print(f"Input: {float(data["pricing"]["prompt"]) * 1000000:.2f}/1M tokens")
print(f"Output: {float(data["pricing"]["completion"]) * 1000000:.2f}/1M tokens")Endpoint:
GET https://llmprices.ai/api/pricing?model=x-ai/grok-code-fast-1Example Response:
{
"id": "x-ai/grok-code-fast-1",
"name": "xAI: Grok Code Fast 1",
"pricing": {
"prompt": "0.0000002",
"completion": "0.0000015",
"input_cache_read": "0.00000002"
}
}