# Quickstart

Issue a key, point your client at the DI base URL, and send your first request — in about two minutes.

## 1 · Get an API key

Create a key on the [API Keys](https://app.directinference.com/api-keys) page. Keys look like `llm_live_…` and authenticate every surface. Copy it when it is shown — the full value is only displayed once.

:::caution[Treat keys like passwords]
A key carries your balance. Keep it server-side, out of source control, and rotate it from the API Keys page if it is ever exposed.
:::

## 2 · Install an SDK

DirectInference speaks the OpenAI wire format on this surface, so the stock OpenAI SDK works unchanged. Pick your language:

```bash
pip install openai
```

```bash
npm install openai
```

```bash
# curl ships with macOS and most Linux distributions
```

```bash
go get github.com/openai/openai-go
```

## 3 · Make your first call

Set `base_url` to the DI endpoint and your `api_key` to the key you just issued. Keep sending whatever `model` string your application already uses.

```python
from openai import OpenAI

client = OpenAI(
    api_key="llm_live_...",
    base_url="https://app.directinference.com/di/v1",
)

resp = client.chat.completions.create(
    model="gpt-5.5-mini",
    messages=[{"role": "user", "content": "In one sentence, what is DirectInference?"}],
)

print(resp.choices[0].message.content)
print("model:", resp.model)          # echoes "gpt-5.5-mini"
print("usage:", resp.usage)          # prompt / completion / total tokens
```

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "llm_live_...",
  baseURL: "https://app.directinference.com/di/v1",
});

const resp = await client.chat.completions.create({
  model: "gpt-5.5-mini",
  messages: [{ role: "user", content: "In one sentence, what is DirectInference?" }],
});

console.log(resp.choices[0].message.content);
console.log("model:", resp.model);   // echoes "gpt-5.5-mini"
console.log("usage:", resp.usage);   // prompt / completion / total tokens
```

```bash
curl https://app.directinference.com/di/v1/chat/completions \
  -H "Authorization: Bearer llm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5-mini",
    "messages": [{ "role": "user", "content": "In one sentence, what is DirectInference?" }]
  }'
```

```go
package main

import (
	"context"
	"fmt"

	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
)

func main() {
	client := openai.NewClient(
		option.WithAPIKey("llm_live_..."),
		option.WithBaseURL("https://app.directinference.com/di/v1"),
	)

	resp, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{
		Model: "gpt-5.5-mini",
		Messages: []openai.ChatCompletionMessageParamUnion{
			openai.UserMessage("In one sentence, what is DirectInference?"),
		},
	})
	if err != nil {
		panic(err)
	}

	fmt.Println(resp.Choices[0].Message.Content)
	fmt.Println("model:", resp.Model) // echoes "gpt-5.5-mini"
}
```

:::tip[The model id comes back unchanged]
`resp.model` equals the exact id you sent. Model selection happens behind the endpoint; your logging and evals see the same model string they always have.
:::

## 4 · Use your own SDK

Already built on a specific vendor SDK? Each surface is a first-class drop-in — keep your client and just change the base URL.

[OpenAI-compatible](https://docs.directinference.com/openai/)
  [Anthropic Messages](https://docs.directinference.com/anthropic/)
  [Gemini](https://docs.directinference.com/gemini/)
:::note[Coming from another vendor or service?]
The switch is a base-URL change — your SDK, model ids, and request code stay put. See [Migrate to DirectInference](https://docs.directinference.com/migrate/) for the per-surface base URLs and a checklist.
:::