> For the complete documentation index, see [llms.txt](https://docs.commonstack.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commonstack.ai/overview/quickstart.md).

# Quickstart

Get from zero to your first API response in under 2 minutes.

{% stepper %}
{% step %}

### **Get your API key**

Sign up at [commonstack.ai](https://commonstack.ai) and generate an API key from your dashboard.
{% endstep %}

{% step %}

### **Make your first request**

{% hint style="info" %}
Commonstack provides two protocol endpoints with the same API key:

* **OpenAI-compatible:** `https://api.commonstack.ai/v1`
* **Anthropic-compatible:** `https://api.commonstack.ai`
  {% endhint %}

{% tabs %}
{% tab title="OpenAI-compatible" %}

```bash
curl https://api.commonstack.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4.1",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

{% endtab %}

{% tab title="Anthropic-compatible" %}

```bash
curl https://api.commonstack.ai/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Use with an SDK

You can use the official OpenAI or Anthropic SDKs. Just point them at Commonstack.

**OpenAI SDK**

{% tabs %}
{% tab title="Python" %}

```python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.commonstack.ai/v1"
)

response = client.chat.completions.create(
    model="openai/gpt-4.1",
    messages=[
        {"role": "user", "content": "What can you help me with?"}
    ]
)

print(response.choices[0].message.content)
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.commonstack.ai/v1",
});

const response = await client.chat.completions.create({
  model: "openai/gpt-4.1",
  messages: [
    { role: "user", content: "What can you help me with?" },
  ],
});

console.log(response.choices[0].message.content);
```

{% endtab %}
{% endtabs %}

**Anthropic SDK**

{% tabs %}
{% tab title="Python" %}

```python
import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.commonstack.ai"
)

message = client.messages.create(
    model="anthropic/claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "What can you help me with?"}
    ]
)

print(message.content[0].text)
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.commonstack.ai",
});

const message = await client.messages.create({
  model: "anthropic/claude-sonnet-4-20250514",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "What can you help me with?" },
  ],
});

console.log(message.content[0].text);
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Browse available models

Visit the [Model Library](https://commonstack.ai/model-library) to see all supported models with pricing, context windows, and cache rates. You can also fetch the list programmatically:

```bash
curl https://api.commonstack.ai/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Model IDs use the format `provider/model-name`. For example:

* `openai/gpt-4.1`
* `anthropic/claude-sonnet-4-20250514`
* `x-ai/grok-4-1-fast-non-reasoning`
* `deepseek/deepseek-r1`
  {% endstep %}

{% step %}

### Try Playground

Don't want to write code yet? Try any model directly in the [Playground](/platform/playground.md). You can adjust parameters, test prompts, and copy the configuration as an API code snippet.
{% endstep %}
{% endstepper %}

### **What's next?**

* See the full [Model Library](https://commonstack.ai/model-library) for pricing and available models
* Learn about [Authentication](/user-guide/authentication.md)&#x20;
* Use the Anthropic SDK? See [Anthropic SDK Compatibility](/user-guide/anthropic-sdk-compatibility.md)
* Send images to vision models with our [Vision and Image Generation](/user-guide/vision-and-image-generation.md)guide
* Manage your API keys and usage in [Account & API Keys](/platform/account-and-api-keys.md)

{% hint style="info" icon="lobster" %}
OpenClaw users please refer to [OpenClaw](/integration-guides/openclaw.md)for using Commonstack API and MCP tools.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.commonstack.ai/overview/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
