Choose your path

Qwen4-35B-A3B sızıntısını, GitHub ipuçlarını, söylentilere konu olan teknik özellikleri ve çıkış zamanlamasını; ayrıca bugün CometAPI üzerinden kullanabileceğiniz mevcut model alternatiflerini keşfedin.

Aşağıdaki örnekler, Python ve CometAPI ile Qwen4-Max’e istek atmayı, ilk isteği göndermeyi, akışlı (stream) yanıt almayı, araçlar (function calling) ve görselleri kullanmayı, ayrıca maliyeti tahmin etmeyi gösterir. Önkoşullar - Python 3.9+ - pip install openai comet-ml - Ortam değişkenleri: - DASHSCOPE_API_KEY: DashScope/OpenAI-uyumlu uç nokta anahtarınız - COMET_API_KEY: Comet API anahtarınız (comet_ml için) - (İsteğe bağlı) QWEN4_MAX_INPUT_USD_PER_1K ve QWEN4_MAX_OUTPUT_USD_PER_1K: 1K giriş/çıkış token ücreti (USD) 1) İstemciyi başlatma (OpenAI uyumlu DashScope endpoint) ```python import os from openai import OpenAI DASHSCOPE_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1" client = OpenAI( api_key=os.environ["DASHSCOPE_API_KEY"], base_url=DASHSCOPE_BASE_URL, ) MODEL = "Qwen4-Max" ``` 2) İlk istek (Chat Completions) ```python messages = [ {"role": "user", "content": "Merhaba Qwen4-Max, kısa bir özetle neler yapabildiğini anlatır mısın?"} ] resp = client.chat.completions.create( model=MODEL, messages=messages, ) print(resp.choices[0].message.content) print("usage:", resp.usage) ``` 3) Akışlı (stream) yanıt ```python stream = client.chat.completions.create( model=MODEL, messages=[{"role": "user", "content": "Lütfen 3 maddelik bir madde işaretli liste yaz."}], stream=True, ) for chunk in stream: if chunk.choices and chunk.choices[0].delta: delta = chunk.choices[0].delta if getattr(delta, "content", None): print(delta.content, end="", flush=True) print() ``` 4) Araçlar (function calling) kullanımı ```python import json import random from datetime import datetime def get_weather(city: str): # Örnek sahte sonuç return { "city": city, "temperature_c": round(15 + random.random() * 10, 1), "condition": "Partly Cloudy", "observed_at": datetime.utcnow().isoformat() + "Z", } tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Belirtilen şehir için mevcut hava durumunu döndürür.", "parameters": { "type": "object", "properties": { "city": {"type": "string", "description": "Şehir adı, ör. Istanbul"}, }, "required": ["city"], "additionalProperties": False, }, }, } ] messages = [ {"role": "user", "content": "İstanbul'da hava nasıl? Şemsiye almam gerekir mi?"} ] first = client.chat.completions.create( model=MODEL, messages=messages, tools=tools, tool_choice="auto", ) assistant_msg = first.choices[0].message messages.append({"role": "assistant", "content": assistant_msg.content or "", "tool_calls": assistant_msg.tool_calls}) if assistant_msg.tool_calls: for tc in assistant_msg.tool_calls: if tc.type == "function" and tc.function.name == "get_weather": args = json.loads(tc.function.arguments or "{}") result = get_weather(args.get("city", "")) messages.append({ "role": "tool", "tool_call_id": tc.id, "name": tc.function.name, "content": json.dumps(result, ensure_ascii=False), }) second = client.chat.completions.create( model=MODEL, messages=messages, ) print(second.choices[0].message.content) else: print(assistant_msg.content) ``` 5) Görsel (multimodal) giriş kullanımı ```python messages = [ { "role": "user", "content": [ {"type": "text", "text": "Bu görseli kısaca açıklar mısın?"}, { "type": "image_url", "image_url": { "url": "https://example.com/sample.jpg" } } ], } ] resp = client.chat.completions.create( model=MODEL, messages=messages, ) print(resp.choices[0].message.content) ``` 6) Maliyeti tahmin etme ve Comet’e loglama - usage alanı (prompt_tokens, completion_tokens) üzerinden maliyeti hesaplayın. - Fiyatları biliniyorsa sabit olarak, bilinmiyorsa ortam değişkenleriyle verin. - Sonuçları Comet’e (comet_ml) loglayın. ```python import os from comet_ml import Experiment QWEN4_MAX_INPUT_USD_PER_1K = float(os.getenv("QWEN4_MAX_INPUT_USD_PER_1K", "0.0")) QWEN4_MAX_OUTPUT_USD_PER_1K = float(os.getenv("QWEN4_MAX_OUTPUT_USD_PER_1K", "0.0")) def estimate_cost_usd(prompt_tokens: int, completion_tokens: int): input_cost = (prompt_tokens / 1000.0) * QWEN4_MAX_INPUT_USD_PER_1K output_cost = (completion_tokens / 1000.0) * QWEN4_MAX_OUTPUT_USD_PER_1K return { "input_usd": round(input_cost, 6), "output_usd": round(output_cost, 6), "total_usd": round(input_cost + output_cost, 6), } # Comet deneyimi başlat experiment = Experiment( api_key=os.environ["COMET_API_KEY"], project_name="qwen4-max", auto_output_logging=False, auto_param_logging=False, auto_metric_logging=False, ) # Basit bir istek gönder ve maliyeti hesapla + logla messages = [{"role": "user", "content": "Bana İstanbul hakkında 2 ilginç bilgi ver."}] resp = client.chat.completions.create( model=MODEL, messages=messages, ) text = resp.choices[0].message.content ptoks = getattr(resp.usage, "prompt_tokens", 0) or 0 ctoks = getattr(resp.usage, "completion_tokens", 0) or 0 cost = estimate_cost_usd(ptoks, ctoks) print(text) print("tokens:", {"prompt": ptoks, "completion": ctoks}) print("cost_usd:", cost) # Comet’e logla experiment.log_text("prompt", str(messages)) experiment.log_text("response", text) experiment.log_metrics({ "prompt_tokens": ptoks, "completion_tokens": ctoks, "total_tokens": ptoks + ctoks, "cost_input_usd": cost["input_usd"], "cost_output_usd": cost["output_usd"], "cost_total_usd": cost["total_usd"], }) experiment.log_other("model", MODEL) experiment.log_other("provider", "DashScope OpenAI-compatible") ``` 7) Akışlı yanıtlarda maliyet tahmini - Akışlı yanıtta usage her zaman dönmeyebilir. Stratejiler: - Aynı mesajla stream=False tekrar çağırıp usage almak (ek ücret doğurur). - Sağlayıcı kullanım raporlama API’sını kullanmak (varsa). - Token sayısını yaklaşık tahmin için bir tokenizer ile lokal sayım yapmak (model tokenizer uyumluluğuna dikkat). Örnek: Stream ardından ikinci bir non-stream çağrı ile yalnızca usage almak ```python messages = [{"role": "user", "content": "Bir haiku yaz."}] stream = client.chat.completions.create(model=MODEL, messages=messages, stream=True) collected = [] for chunk in stream: if chunk.choices and chunk.choices[0].delta and getattr(chunk.choices[0].delta, "content", None): piece = chunk.choices[0].delta.content collected.append(piece) print(piece, end="", flush=True) print() # Yalnızca usage almak için aynı istek (ek çağrı) resp_for_usage = client.chat.completions.create(model=MODEL, messages=messages) ptoks = getattr(resp_for_usage.usage, "prompt_tokens", 0) or 0 # Çıkış token'ı bu eşdeğeri olmayabilir; stream çıktısı farklılaşabilir ctoks = getattr(resp_for_usage.usage, "completion_tokens", 0) or 0 cost = estimate_cost_usd(ptoks, ctoks) print("approx_cost_usd:", cost) ``` Notlar - MODEL adını Qwen4-Max olarak kullandık. Sağlayıcıdaki gerçek model adınız farklıysa (ör. qwen2.5-max, qwen-4-max vb.) aynı kodda model ismini güncelleyin. - Görsel girdi için URL erişilebilir olmalı. Base64 veya dosya upload gerektiren durumlar için sağlayıcının multimodal belgelerini izleyin. - Araç çağırmada, modelin döndürdüğü tool_calls listesini kontrol edip ilgili fonksiyonu güvenli biçimde çalıştırın ve sonucu role="tool" mesajı olarak geri verin.

Qwen4-Max özelliklerini, benchmark sonuçlarını, API fiyatlandırmasını ve Token Plan seçeneklerini keşfedin. 1M token bağlam penceresine sahip Qwen'in amiral gemisi modeline nasıl erişebileceğinizi öğrenin.

Qwen4-Max-Preview Yayınlandı: Alibaba’nın Yeni Nesil Amiral Gemisi Yapay Zeka Modeli, 1M Bağlam Penceresiyle – Tam Teknik Özellikler, Gerçek Dünya Deneyimi, Erişim Kılavuzu

Qwen 4'ün çıkış tarihi tahminini, erken benchmark liderliğini ve modellerini keşfedin; geliştiricilerin lansmanda nelere dikkat etmesi gerektiğine bakın, beklemeli misiniz kontrol edin.

请提供需要翻译成土耳其语的原文内容;若需我基于该主题撰写并直接输出土耳其语比较,请确认目标格式(纯文本/Markdown/HTML/JSON)与任何术语偏好。

CometAPI ile Qwen Image 3.0 API'yi metinden görüntüye, çoklu referanslı düzenleme, parametreler, kod ve fiyatlandırma için nasıl kullanacağınızı öğrenin.

Python, cURL, görseller, ses ve video ile Qwen3.8-Omni-Flash API'si nasıl kullanılır; üretim rehberi ve CometAPI kullanılabilirlik kontrolleri dahil.