# Providers

> The providers Lykia connects to directly, with the ids used in routing preferences and responses.

`GET https://api.getlykia.com/v1/providers`

Returns the providers Lykia connects to directly, sorted by name. The `slug` values here are the ids you use in the `provider` object of a [`POST /chat/completions`](https://www.getlykia.com/en/docs/api-reference/chat-completions) request (`order`, `only`, `ignore`), the ones you see in the `provider` field of responses, and the ones you pick when you add a [provider key](https://www.getlykia.com/en/docs/guides/byok) to a project. If Lykia has no key of its own at a listed provider, that provider's models can be used only once you add your own key for it to your project; [`GET /models`](https://www.getlykia.com/en/docs/api-reference/models) shows which models your project can use.

## Example

**Request**

cURL

```bash
curl https://api.getlykia.com/v1/providers \
  -H "Authorization: Bearer $LYKIA_API_KEY"
```

Python

```python
import os

import requests

response = requests.get(
    "https://api.getlykia.com/v1/providers",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()

for provider in response.json()["data"]:
    print(provider["slug"], provider["name"], provider["headquarters"])
```

TypeScript

```typescript
const response = await fetch("https://api.getlykia.com/v1/providers", {
  headers: { Authorization: `Bearer ${process.env.LYKIA_API_KEY}` },
});
if (!response.ok) {
  throw new Error(`Lykia returned ${response.status}: ${await response.text()}`);
}

const { data: providers } = await response.json();
for (const provider of providers) {
  console.log(provider.slug, provider.name, provider.headquarters);
}
```

Go

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, "https://api.getlykia.com/v1/providers", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("LYKIA_API_KEY"))

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	if resp.StatusCode != http.StatusOK {
		panic(fmt.Sprintf("Lykia returned %d: %s", resp.StatusCode, body))
	}

	var result struct {
		Data []struct {
			Slug         string `json:"slug"`
			Name         string `json:"name"`
			Headquarters string `json:"headquarters"`
		} `json:"data"`
	}
	if err := json.Unmarshal(body, &result); err != nil {
		panic(err)
	}
	for _, provider := range result.Data {
		fmt.Println(provider.Slug, provider.Name, provider.Headquarters)
	}
}
```

**Response (200)**

```json
{
  "data": [
    {
      "name": "Anthropic",
      "slug": "anthropic",
      "privacy_policy_url": null,
      "terms_of_service_url": null,
      "status_page_url": null,
      "headquarters": null,
      "datacenters": null
    },
    {
      "name": "OpenAI",
      "slug": "openai",
      "privacy_policy_url": null,
      "terms_of_service_url": null,
      "status_page_url": null,
      "headquarters": null,
      "datacenters": null
    }
  ]
}
```

## Response

The response is a `data` array of provider objects.

- `name` (string) — Display name.
- `slug` (string) — The provider id, for example `anthropic`. Routing preferences refer to providers by this value.
- `privacy_policy_url` (string | null) — The provider's privacy policy.
- `terms_of_service_url` (string | null) — The provider's terms of service.
- `status_page_url` (string | null) — The provider's status page.
- `headquarters` (string | null) — Two-letter code of the country where the provider is based.
- `datacenters` (string\[] | null) — Country codes of its data centres.

The last five fields are there for compatibility and are currently `null`; review a provider's policies on its own site.

To send requests to particular providers or keep some out, see [Provider routing](https://www.getlykia.com/en/docs/guides/provider-routing).
