モデル一覧に戻る
openrouter logo
openrouter/free

random-free

Global: 無料

200,000 トークン
入力: ¥0/M
出力: ¥0/M

仕様

モダリティ

入力
text
image
出力
text

コード例

curl https://api.fastmetal.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "random-free",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

random-freeの実際の回答

FastMetal上で実際に記録した、標準プロンプトへの回答です。

このエラーをデバッグして

以下のエラーがPythonアプリケーションで発生しています。原因を特定して修正してください。 Traceback (most recent call last): File "app.py", line 23, in get_user_orders total = sum(order["price"] * order["quantity"] for order in orders) TypeError: unsupport…

The error occurs becausethe `orders` query returns tuples (not dictionaries), and the code incorrectly accesses them using dictionary syntax (`order["price"]`). Additionally, the `price` and `quantity` values are strings from the database, causing a type mismatch when multiplied. ### Fixes: 1. **Access tuple elements by index** (not dictionary keys). 2. **Convert string values to integers** before multiplication. ### Corrected Code: ```python def get_user_orders(user_id): orders = db.query("SELECT price, quantity FROM orders WHERE user_id = %s", user_id) total = sum(int(order[0]) * int(order[1]) for order in orders) return {"user_id": user_id, "total": total, "orders": orders}…
応答時間 6.4秒出力 917 トークン

コードレビュー

以下のTypeScript関数をレビューして、可読性・パフォーマンス・ベストプラクティスの観点から改善点を提案してください。 async function fetchAllUsers(page: number = 1): Promise<any[]> { let allUsers: any[] = []; let hasMore = true; let currentPage = page; while (hasMo…

以下は改善点を盛り込んだリファクタリング版です。 ```typescript interface User { id: string; first_name: string; last_name: string; email: string; status: string; } interface ApiResponse { users: User[]; } interface ProcessedUser { id: string; name: string; email: string; } async function fetchAllUsers(page: number = 1): Promise<ProcessedUser[]> { const allUsers: ProcessedUser[] = []; const limit = 100; let currentPage = page; while (true) { const response = await fetch(`/api/users?page=${currentPage}&limit=${limit}`); if (!response.ok) { throw new Error(`Failed to fetch users: ${response.statusText}`); } const data: ApiResponse = await response.json();…
応答時間 6.3秒出力 551 トークン

SQLクエリの最適化

以下のSQLクエリは500万行のテーブルに対して実行すると30秒以上かかります。最適化してください。 SELECT p.product_name, c.category_name, COUNT(o.order_id) as order_count, SUM(o.amount) as total_sales, AVG(r.rating) as avg_rating FROM products p LEFT JOIN…

このクエリのパフォーマンス改善には、以下の戦略が有効です。 **1. インデックスの追加:** 現状のインデックスは `products(id)` と `orders(order_id)` のみですが、以下のインデックスを追加することで大幅な改善が見込めます。 * **`products(category_id, is_active)`:** `products` テーブルに `category_id` と `is_active` の複合インデックスを作成します。これにより、`WHERE p.is_active = true` および `JOIN categories c ON c.id = p.category_id` の処理が高速化されます。`is_active` が `true` のレコードに絞り込む処理を効率化します。 * **`orders(product_id, status, created_at)`:** `orders` テーブルに `product_id`, `status`, `created_at` の複合インデックスを作成します。これにより、`JOIN order_details od ON od.product_id = p.id` と `WHERE o.status = '完了' AND o.created_at >= '2024-04-01'` の処理が効率化されます。`status` と `created_at` を組み合わせることで、より絞り込みやすくなります。 * **`order_details(product_id,…
応答時間 81.2秒出力 1098 トークン

他のモデルと並べて比較する →

よくある質問

random-freeのAPI料金はいくらですか?
FastMetalでは100万トークンあたり入力¥0・出力¥0(税別)の円建て従量課金です。前払いクレジットから使った分だけ差し引かれ、月額料金やサブスクリプションはありません。
random-freeはOpenAI SDKからそのまま使えますか?
はい。base_url を https://api.fastmetal.ai/v1 に変更し、model に "random-free" を指定するだけで、既存のOpenAI向けコードから呼び出せます。ストリーミング、ツール呼び出し、構造化出力にも対応しています。
random-freeのコンテキスト長はどのくらいですか?
200,000トークンです。プロンプトと回答を合わせてこの範囲に収める必要があります。
random-freeを試すには何が必要ですか?
アカウントを作成してクレジットをチャージすると、ブラウザのチャット画面とAPIの両方から利用できます。契約や最低利用額はありません。

random-freeを今すぐ試す

random-freeはFastMetalのAPIキー1つで利用できます。ブラウザですぐに試す、またはOpenAI SDKからそのまま呼び出せます。

Openrouterの他のモデル