> For clean Markdown of any page, append `.md` to the page URL.
> Documentation index: https://you.com/docs/llms.txt (section indexes: append `/llms.txt` to any section URL).
> Search these docs: Docs MCP at https://you.com/docs/_mcp/server (`searchDocs`, no API key).
> Call live You.com APIs: Product MCP at https://api.you.com/mcp (keyless `?profile=free` exposes `you-search` and `you-discover`. Research and finance use `/mcp/research`, `/mcp/finance`, or `?tools=` on `/mcp`). To pick an API or integration path, call `you-discover` on that server instead of guessing.
> OpenAPI: https://you.com/docs/openapi.json—auth header `X-API-Key`, env `YDC_API_KEY`.

# List Models

GET https://api.you.com/v1/models

Returns the models your key may call, with their token limits. Send an `anthropic-version` header to get the Anthropic Models API format. Otherwise the response is in OpenAI format.

Reference: https://you.com/docs/api-reference/inference-router/list-models

## Authentication

- `Authorization` header (bearer token, required) — Your You.com API key, sent as `Authorization: Bearer <key>`. Get a key in the ["Get your API key" section of the documentation](https://you.com/docs/quickstart#get-your-api-key).

## Request

### Headers

- `anthropic-version` (string, optional) — The Anthropic API version, such as `2023-06-01`. Sending this header selects the Anthropic response format.

## Response

### 200

The models available to your key.

- `listModels_Response_200`
  - ModelListOpenAI: ModelListOpenAI
  - ModelListAnthropic: ModelListAnthropic

## Errors

### 401 Unauthorized Error

The API key is missing or invalid.

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

The API key has no access to the requested model or service.

- `error` (ErrorResponseError, required)

## Types

### ModelListOpenAI

- `object` (enum, optional)
  - Allowed values: `list`
- `data` (list of ModelListOpenAiDataItems, optional)

### ModelListAnthropic

- `data` (list of ModelListAnthropicDataItems, optional)
- `has_more` (boolean, optional)
- `first_id` (string, optional, nullable)
- `last_id` (string, optional, nullable)

### ErrorResponseError

- `message` (string, required) — A description of the error.
- `type` (string, optional) — The error type.
- `param` (string, optional, nullable) — The request parameter that caused the error, when known.
- `code` (string, optional, nullable) — The error code.

### ModelListOpenAiDataItems

- `id` (string, optional)
- `object` (enum, optional)
  - Allowed values: `model`
- `max_input_tokens` (integer, optional) — Context window in tokens. Omitted when the limit is not published for the model.
- `max_tokens` (integer, optional) — Largest output a request may ask for. Omitted when the limit is not published for the model.

### ModelListAnthropicDataItems

- `type` (enum, optional)
  - Allowed values: `model`
- `id` (string, optional)
- `display_name` (string, optional)
- `max_input_tokens` (integer, optional, nullable) — Context window in tokens, or `null` when not published.
- `max_tokens` (integer, optional, nullable) — Largest output a request may ask for, or `null` when not published.

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "string",
      "max_input_tokens": 1,
      "max_tokens": 1,
      "object": "model"
    }
  ],
  "object": "list"
}
```

**SDK Code**

```python
import requests

url = "https://api.you.com/v1/models"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.you.com/v1/models';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.you.com/v1/models"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.you.com/v1/models")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.you.com/v1/models");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.you.com/v1/models")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```