Docs · Quickstart
Your first call,in three minutes
It's OpenAI-compatible. Get an API key, point the base URL at Firmrock, and you can use 700+ models. Python, Node.js or curl.
base_url = "https://firmrock.ai/v1" # base URLapi_key = "your API key" # from the consolemodel = "anthropic/claude-sonnet" # provider/model
Three steps
From zero to the first reply
- 01
Get an API key
Click “Get an API key” and create one in the console. Keep it in an environment variable, not in your code.
Terminalexport FIRMROCK_API_KEY="your API key" # the code below reads it - 02
Change the base URL
Already using an OpenAI SDK? Change the URL and the key, nothing else. To leave, change the URL back.
The two lines to change, in each version# Pythonbase_url="https://firmrock.ai/v1",api_key=os.environ["FIRMROCK_API_KEY"], // Node.jsbaseURL: "https://firmrock.ai/v1",apiKey: process.env.FIRMROCK_API_KEY, # curlcurl https://firmrock.ai/v1/chat/completions-H "Authorization: Bearer $FIRMROCK_API_KEY"
Not using an OpenAI SDK? The full code is below. - 03
Send your first request
Pick one of the three versions below and run it. When you see the model's reply, you're done.
Full code
Your first request, three ways
All three send the same request. Copy and run.
- 01
Python
Uses the official OpenAI Python SDK. Install the openai package first.
Run · Python# pip install openai import osfrom openai import OpenAI client = OpenAI( base_url="https://firmrock.ai/v1", # point here api_key=os.environ["FIRMROCK_API_KEY"], # your key) reply = client.chat.completions.create( model="anthropic/claude-sonnet", messages=[{"role": "user", "content": "Hello"}],)print(reply.choices[0].message.content)
- 02
Node.js
Uses the official OpenAI Node.js SDK. Install the openai package first, and save the file as .mjs.
Run · Node.js// npm install openai import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://firmrock.ai/v1", apiKey: process.env.FIRMROCK_API_KEY,}); const reply = await client.chat.completions.create({ model: "anthropic/claude-sonnet", messages: [{ role: "user", content: "Hello" }],});console.log(reply.choices[0].message.content);
- 03
curl
Nothing to install. Send it straight from your terminal.
Run · curlcurl https://firmrock.ai/v1/chat/completions \ -H "Authorization: Bearer $FIRMROCK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet", "messages": [{"role": "user", "content": "Hello"}] }'
After your first call
What you'll use next
FAQ
Questions on the first connection
Do I need a new SDK?
No. It's OpenAI-compatible, so the OpenAI SDK works. Change the URL and the key.
What do I change to switch models?
Only the model parameter. The URL and the key stay the same.
Do I need to write retries?
No. On a timeout or a 5xx, the request moves to the next provider within the same call, in under 20 ms. Failed requests are free.
How am I charged?
No monthly fee, pay for what you use. Each call is billed on its own, and the bill traces back to keys and requests.
What if I overspend while testing?
Set a budget on the key. It stops at the limit and warns you before it gets there.
What if I want to go back?
Change the URL and the key back. Nothing else in your code changes.
Get started
Get a key, send your first request
No monthly fee. Pay for what you use.