> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# モデルを取得

> モデルインスタンスを取得します

## パスパラメータ

<ParamField path="model" type="string" required>
  取得するモデルの ID（例: `gpt-5.4`, `claude-sonnet-4-6`）。
</ParamField>

## レスポンス

<ResponseField name="id" type="string">
  モデル識別子。
  `lifecycle`、`commercial`、`badges` も含まれ、非推奨/退役状態、ユーザー課金ポリシー、表示バッジを示します。
</ResponseField>

<ResponseField name="object" type="string">
  常に `model`。
</ResponseField>

<ResponseField name="created" type="integer">
  作成タイムスタンプ。
</ResponseField>

<ResponseField name="owned_by" type="string">
  モデルプロバイダー。
</ResponseField>

<ResponseField name="tokenlab" type="object">
  TokenLab 固有の公開メタデータです。詳細ルートでは、`category`、`pricing_unit`、`capability_flags`、`supported_operations`、`pricing_provenance`、`request_format_summary`、完全な `request_format_details`、そして非チャット推奨スナップショット用のシーン別 `agent_preferences` を含めることができます。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.tokenlab.sh/v1/models/gpt-5.4" \
    -H "Authorization: Bearer sk-your-api-key"
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-your-api-key",
      base_url="https://api.tokenlab.sh/v1"
  )

  model = client.models.retrieve("gpt-5.4")
  print(f"Model: {model.id}, Provider: {model.owned_by}")
  ```

  ```javascript JavaScript theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: 'sk-your-api-key',
    baseURL: 'https://api.tokenlab.sh/v1'
  });

  const model = await client.models.retrieve('gpt-5.4');
  console.log(`Model: ${model.id}, Provider: ${model.owned_by}`);
  ```

  ```go Go theme={null}
  package main

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

  func main() {
      req, _ := http.NewRequest("GET", "https://api.tokenlab.sh/v1/models/gpt-5.4", nil)
      req.Header.Set("Authorization", "Bearer sk-your-api-key")

      resp, _ := http.DefaultClient.Do(req)
      defer resp.Body.Close()

      var model map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&model)
      fmt.Printf("Model: %s, Provider: %s\n", model["id"], model["owned_by"])
  }
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://api.tokenlab.sh/v1/models/gpt-5.4');

  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer sk-your-api-key'
      ]
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $model = json_decode($response, true);
  echo "Model: {$model['id']}, Provider: {$model['owned_by']}\n";
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "gpt-5.4",
    "object": "model",
    "created": 1706000000,
    "owned_by": "openai"
  }
  ```
</ResponseExample>

## 非チャット推奨メタデータ

非チャットモデルの場合、詳細ルートは `tokenlab.agent_preferences.<scene>` も返します。

確認できる項目:

* `preferred_rank`
* `success_rate_24h`
* `sample_count_24h`
* `status`
* `updated_at`

公開レスポンスは `basis.source` で推薦根拠を要約し、ルーティング識別子は公開しません。

## 公開詳細メタデータ

`GET /v1/models` と比べると、詳細ルートではさらに次を返せます:

* `tokenlab.capability_flags`
* `tokenlab.supported_operations`
* `tokenlab.pricing_provenance`
* `tokenlab.request_format_summary`
* `tokenlab.request_format_details`

## エラーハンドリング

モデルが存在しない場合は、404 エラーが返されます:

```json theme={null}
{
  "error": {
    "message": "Model 'invalid-model' not found",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}
```

## モデル削除

`DELETE /v1/models/{model}` はサポートされません。TokenLab のモデルは共有の公開カタログであり、ユーザー所有のファインチューニング済みモデルではありません。
